Mercurial > public > mercurial-scm > hg
comparison mercurial/sshpeer.py @ 36628:70415568ea65
sshpeer: don't read(0)
read(0) is essentially a no-op. Let's avoid the function call, overhead,
and extra test output by not performing it.
Differential Revision: https://phab.mercurial-scm.org/D2581
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 02 Mar 2018 22:59:12 -0500 |
parents | 1151c731686e |
children | 46f4d71ed505 |
comparison
equal
deleted
inserted
replaced
36627:418f9ea20c35 | 36628:70415568ea65 |
---|---|
521 return int(l) | 521 return int(l) |
522 except ValueError: | 522 except ValueError: |
523 self._abort(error.ResponseError(_("unexpected response:"), l)) | 523 self._abort(error.ResponseError(_("unexpected response:"), l)) |
524 | 524 |
525 def _readframed(self): | 525 def _readframed(self): |
526 return self._pipei.read(self._getamount()) | 526 size = self._getamount() |
527 if not size: | |
528 return b'' | |
529 | |
530 return self._pipei.read(size) | |
527 | 531 |
528 def _writeframed(self, data, flush=False): | 532 def _writeframed(self, data, flush=False): |
529 self._pipeo.write("%d\n" % len(data)) | 533 self._pipeo.write("%d\n" % len(data)) |
530 if data: | 534 if data: |
531 self._pipeo.write(data) | 535 self._pipeo.write(data) |