Show More
@@ -283,7 +283,7 b' class sshserver(abstractserverproto):' | |||||
283 | return [data[k] for k in keys] |
|
283 | return [data[k] for k in keys] | |
284 |
|
284 | |||
285 | def getfile(self, fpout): |
|
285 | def getfile(self, fpout): | |
286 | self.sendresponse('') |
|
286 | self._sendresponse('') | |
287 | count = int(self._fin.readline()) |
|
287 | count = int(self._fin.readline()) | |
288 | while count: |
|
288 | while count: | |
289 | fpout.write(self._fin.read(count)) |
|
289 | fpout.write(self._fin.read(count)) | |
@@ -292,25 +292,25 b' class sshserver(abstractserverproto):' | |||||
292 | def redirect(self): |
|
292 | def redirect(self): | |
293 | pass |
|
293 | pass | |
294 |
|
294 | |||
295 | def sendresponse(self, v): |
|
295 | def _sendresponse(self, v): | |
296 | self._fout.write("%d\n" % len(v)) |
|
296 | self._fout.write("%d\n" % len(v)) | |
297 | self._fout.write(v) |
|
297 | self._fout.write(v) | |
298 | self._fout.flush() |
|
298 | self._fout.flush() | |
299 |
|
299 | |||
300 | def sendstream(self, source): |
|
300 | def _sendstream(self, source): | |
301 | write = self._fout.write |
|
301 | write = self._fout.write | |
302 | for chunk in source.gen: |
|
302 | for chunk in source.gen: | |
303 | write(chunk) |
|
303 | write(chunk) | |
304 | self._fout.flush() |
|
304 | self._fout.flush() | |
305 |
|
305 | |||
306 | def sendpushresponse(self, rsp): |
|
306 | def _sendpushresponse(self, rsp): | |
307 | self.sendresponse('') |
|
307 | self._sendresponse('') | |
308 | self.sendresponse(str(rsp.res)) |
|
308 | self._sendresponse(str(rsp.res)) | |
309 |
|
309 | |||
310 | def sendpusherror(self, rsp): |
|
310 | def _sendpusherror(self, rsp): | |
311 | self.sendresponse(rsp.res) |
|
311 | self._sendresponse(rsp.res) | |
312 |
|
312 | |||
313 | def sendooberror(self, rsp): |
|
313 | def _sendooberror(self, rsp): | |
314 | self._ui.ferr.write('%s\n-\n' % rsp.message) |
|
314 | self._ui.ferr.write('%s\n-\n' % rsp.message) | |
315 | self._ui.ferr.flush() |
|
315 | self._ui.ferr.flush() | |
316 | self._fout.write('\n') |
|
316 | self._fout.write('\n') | |
@@ -321,22 +321,22 b' class sshserver(abstractserverproto):' | |||||
321 | pass |
|
321 | pass | |
322 | sys.exit(0) |
|
322 | sys.exit(0) | |
323 |
|
323 | |||
324 | handlers = { |
|
324 | _handlers = { | |
325 | str: sendresponse, |
|
325 | str: _sendresponse, | |
326 | wireproto.streamres: sendstream, |
|
326 | wireproto.streamres: _sendstream, | |
327 | wireproto.streamres_legacy: sendstream, |
|
327 | wireproto.streamres_legacy: _sendstream, | |
328 | wireproto.pushres: sendpushresponse, |
|
328 | wireproto.pushres: _sendpushresponse, | |
329 | wireproto.pusherr: sendpusherror, |
|
329 | wireproto.pusherr: _sendpusherror, | |
330 | wireproto.ooberror: sendooberror, |
|
330 | wireproto.ooberror: _sendooberror, | |
331 | } |
|
331 | } | |
332 |
|
332 | |||
333 | def serve_one(self): |
|
333 | def serve_one(self): | |
334 | cmd = self._fin.readline()[:-1] |
|
334 | cmd = self._fin.readline()[:-1] | |
335 | if cmd and cmd in wireproto.commands: |
|
335 | if cmd and cmd in wireproto.commands: | |
336 | rsp = wireproto.dispatch(self._repo, self, cmd) |
|
336 | rsp = wireproto.dispatch(self._repo, self, cmd) | |
337 | self.handlers[rsp.__class__](self, rsp) |
|
337 | self._handlers[rsp.__class__](self, rsp) | |
338 | elif cmd: |
|
338 | elif cmd: | |
339 | self.sendresponse("") |
|
339 | self._sendresponse("") | |
340 | return cmd != '' |
|
340 | return cmd != '' | |
341 |
|
341 | |||
342 | def _client(self): |
|
342 | def _client(self): |
General Comments 0
You need to be logged in to leave comments.
Login now