Mercurial > public > mercurial-scm > hg
diff tests/sshprotoext.py @ 36214:3b3a987bbbaa
wireprotoserver: move SSH server operation to a standalone function
The server-side processing logic will soon get a bit more complicated
in order to handle protocol switches. We will use a state machine
to help make the transitions clearer.
To prepare for this, we move SSH server operation into a standalone
function. We structure it as a very simple state machine. It only
has two states for now, with one state containing the bulk of the
logic. But things will evolve shortly.
Differential Revision: https://phab.mercurial-scm.org/D2203
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 08 Feb 2018 15:09:59 -0800 |
parents | 30cc9f9780df |
children | 464bedc0fdb4 |
line wrap: on
line diff
--- a/tests/sshprotoext.py Wed Feb 14 17:35:13 2018 -0700 +++ b/tests/sshprotoext.py Thu Feb 08 15:09:59 2018 -0800 @@ -48,7 +48,9 @@ wireprotoserver._sshv1respondbytes(self._fout, b'') l = self._fin.readline() assert l == b'between\n' - rsp = wireproto.dispatch(self._repo, self._proto, b'between') + proto = wireprotoserver.sshv1protocolhandler(self._ui, self._fin, + self._fout) + rsp = wireproto.dispatch(self._repo, proto, b'between') wireprotoserver._sshv1respondbytes(self._fout, rsp.data) super(prehelloserver, self).serve_forever() @@ -72,8 +74,10 @@ self._fin.read(81) # Send the upgrade response. + proto = wireprotoserver.sshv1protocolhandler(self._ui, self._fin, + self._fout) self._fout.write(b'upgraded %s %s\n' % (token, name)) - servercaps = wireproto.capabilities(self._repo, self._proto) + servercaps = wireproto.capabilities(self._repo, proto) rsp = b'capabilities: %s' % servercaps.data self._fout.write(b'%d\n' % len(rsp)) self._fout.write(rsp)