##// END OF EJS Templates
wireprotoserver: rename p to proto...
Gregory Szorc -
r35882:bd38ccf4 default
parent child Browse files
Show More
@@ -194,7 +194,7 b' def iscmd(cmd):'
194 return cmd in wireproto.commands
194 return cmd in wireproto.commands
195
195
196 def callhttp(repo, req, cmd):
196 def callhttp(repo, req, cmd):
197 p = webproto(req, repo.ui)
197 proto = webproto(req, repo.ui)
198
198
199 def genversion2(gen, engine, engineopts):
199 def genversion2(gen, engine, engineopts):
200 # application/mercurial-0.2 always sends a payload header
200 # application/mercurial-0.2 always sends a payload header
@@ -207,7 +207,7 b' def callhttp(repo, req, cmd):'
207 for chunk in gen:
207 for chunk in gen:
208 yield chunk
208 yield chunk
209
209
210 rsp = wireproto.dispatch(repo, p, cmd)
210 rsp = wireproto.dispatch(repo, proto, cmd)
211 if isinstance(rsp, bytes):
211 if isinstance(rsp, bytes):
212 req.respond(HTTP_OK, HGTYPE, body=rsp)
212 req.respond(HTTP_OK, HGTYPE, body=rsp)
213 return []
213 return []
@@ -220,7 +220,8 b' def callhttp(repo, req, cmd):'
220
220
221 # This code for compression should not be streamres specific. It
221 # This code for compression should not be streamres specific. It
222 # is here because we only compress streamres at the moment.
222 # is here because we only compress streamres at the moment.
223 mediatype, engine, engineopts = p.responsetype(rsp.prefer_uncompressed)
223 mediatype, engine, engineopts = proto.responsetype(
224 rsp.prefer_uncompressed)
224 gen = engine.compressstream(gen, engineopts)
225 gen = engine.compressstream(gen, engineopts)
225
226
226 if mediatype == HGTYPE2:
227 if mediatype == HGTYPE2:
@@ -229,14 +230,14 b' def callhttp(repo, req, cmd):'
229 req.respond(HTTP_OK, mediatype)
230 req.respond(HTTP_OK, mediatype)
230 return gen
231 return gen
231 elif isinstance(rsp, wireproto.pushres):
232 elif isinstance(rsp, wireproto.pushres):
232 val = p.restore()
233 val = proto.restore()
233 rsp = '%d\n%s' % (rsp.res, val)
234 rsp = '%d\n%s' % (rsp.res, val)
234 req.respond(HTTP_OK, HGTYPE, body=rsp)
235 req.respond(HTTP_OK, HGTYPE, body=rsp)
235 return []
236 return []
236 elif isinstance(rsp, wireproto.pusherr):
237 elif isinstance(rsp, wireproto.pusherr):
237 # drain the incoming bundle
238 # drain the incoming bundle
238 req.drain()
239 req.drain()
239 p.restore()
240 proto.restore()
240 rsp = '0\n%s\n' % rsp.res
241 rsp = '0\n%s\n' % rsp.res
241 req.respond(HTTP_OK, HGTYPE, body=rsp)
242 req.respond(HTTP_OK, HGTYPE, body=rsp)
242 return []
243 return []
General Comments 0
You need to be logged in to leave comments. Login now