This is an archive of the discontinued Mercurial Phabricator instance.

sshpeer: move URL validation out of sshpeer.__init__
ClosedPublic

Authored by indygreg on Feb 4 2018, 10:35 PM.

Details

Summary

We will soon have another SSH peer class to support the new version
of the SSH protocol. However, we won't know which peer class to
instantiate until we perform a handshake on an active connection.
This means that we need to move connection establishment and handshake
code out of sshpeer.init.

This commit starts the process of migrating peer creation code
out of sshpeer.init into instance(), which is the API for
creating peers.

The moved code no longer calls _abort(). _abort() runs _cleanup() and
raises. _cleanup() only performs actions on self._pipe*. These objects
aren't instantiated until we actually connect to the peer. So _abort()
was not necessary in the old code.

To keep the API the same, init() now makes a redundant call to
util.url(). This will be fixed in subsequent commits.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

indygreg created this revision.Feb 4 2018, 10:35 PM
lothiraldan accepted this revision.Feb 5 2018, 7:52 AM
yuja accepted this revision.Feb 6 2018, 8:07 AM
This revision is now accepted and ready to land.Feb 6 2018, 8:07 AM
This revision was automatically updated to reflect the committed changes.