Separate socket creation and connection to be able to cancel it

This commit is contained in:
shortcutme 2017-10-03 14:30:19 +02:00
parent f4cdc31788
commit d8453384ab
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 2 additions and 3 deletions

View file

@ -104,7 +104,8 @@ class Connection(object):
raise Exception("Can't connect to onion addresses, no Tor controller present")
self.sock = self.server.tor_manager.createSocket(self.ip, self.port)
else:
self.sock = socket.create_connection((self.ip, int(self.port)))
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.connect((self.ip, int(self.port)))
# Implicit SSL
if self.cert_pin: