Mercurial > hg
changeset 36363:7f8f74531b0b
sshpeer: rename _recv and _send to _readframed and _writeframed
Because it is reading and writing a chunk of data with a well-defined
size. "recv" and "send" make it sound like things are a direct proxy to
the underlying pipe, which they aren't.
Differential Revision: https://phab.mercurial-scm.org/D2378
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 19 Feb 2018 15:57:28 -0800 |
parents | 01e29e885600 |
children | a34d5ef53c2e |
files | mercurial/sshpeer.py |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/sshpeer.py Wed Feb 21 13:41:20 2018 -0800 +++ b/mercurial/sshpeer.py Mon Feb 19 15:57:28 2018 -0800 @@ -452,19 +452,19 @@ def _call(self, cmd, **args): self._callstream(cmd, **args) - return self._recv() + return self._readframed() def _callpush(self, cmd, fp, **args): r = self._call(cmd, **args) if r: return '', r for d in iter(lambda: fp.read(4096), ''): - self._send(d) - self._send("", flush=True) - r = self._recv() + self._writeframed(d) + self._writeframed("", flush=True) + r = self._readframed() if r: return '', r - return self._recv(), '' + return self._readframed(), '' def _calltwowaystream(self, cmd, fp, **args): r = self._call(cmd, **args) @@ -472,8 +472,8 @@ # XXX needs to be made better raise error.Abort(_('unexpected remote reply: %s') % r) for d in iter(lambda: fp.read(4096), ''): - self._send(d) - self._send("", flush=True) + self._writeframed(d) + self._writeframed("", flush=True) return self._pipei def _getamount(self): @@ -488,10 +488,10 @@ except ValueError: self._abort(error.ResponseError(_("unexpected response:"), l)) - def _recv(self): + def _readframed(self): return self._pipei.read(self._getamount()) - def _send(self, data, flush=False): + def _writeframed(self, data, flush=False): self._pipeo.write("%d\n" % len(data)) if data: self._pipeo.write(data)