Handle inplace connect errors correctly

This commit is contained in:
Oleksii Shevchuk 2017-03-11 23:02:11 +02:00
parent faec654b42
commit 9bddbc57a9
1 changed files with 4 additions and 1 deletions

View File

@ -174,7 +174,10 @@ class Connection(object):
self.forward()
def _start_connect(self, address):
self.socket.connect(address, self._on_connected)
try:
self.socket.connect(address, self._on_connected)
except:
self._on_connected(None, -1)
def connect(self, address):
self.loop.queue_work(lambda: self._start_connect(address))