updated connect error checks
This commit is contained in:
parent
0291b50fec
commit
d008b51b64
|
@ -15,6 +15,7 @@
|
||||||
##
|
##
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
|
import errno
|
||||||
|
|
||||||
import common.xmpp
|
import common.xmpp
|
||||||
from common import gajim
|
from common import gajim
|
||||||
|
@ -246,13 +247,15 @@ class HostTester(Socks5, IdleObject):
|
||||||
self._recv=self._sock.recv
|
self._recv=self._sock.recv
|
||||||
except Exception, ee:
|
except Exception, ee:
|
||||||
(errnum, errstr) = ee
|
(errnum, errstr) = ee
|
||||||
if errnum == 111:
|
if errnum in (errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK):
|
||||||
self.on_failure()
|
# still trying to connect
|
||||||
return None
|
return
|
||||||
# win32 needs this
|
# win32 needs this
|
||||||
elif errnum != 10056 or self.state != 0:
|
if errnum not in (0, 10056, errno.EISCONN):
|
||||||
return None
|
# connection failed
|
||||||
else: # socket is already connected
|
self.on_failure()
|
||||||
|
return
|
||||||
|
# socket is already connected
|
||||||
self._sock.setblocking(False)
|
self._sock.setblocking(False)
|
||||||
self._send=self._sock.send
|
self._send=self._sock.send
|
||||||
self._recv=self._sock.recv
|
self._recv=self._sock.recv
|
||||||
|
|
Loading…
Reference in New Issue