From d008b51b6487c2db2eccdcd76b66113afbe42aa8 Mon Sep 17 00:00:00 2001 From: Dimitur Kirov Date: Wed, 10 May 2006 11:22:47 +0000 Subject: [PATCH] updated connect error checks --- src/common/proxy65_manager.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/common/proxy65_manager.py b/src/common/proxy65_manager.py index 4e2fa1d1b..5f2a9f528 100644 --- a/src/common/proxy65_manager.py +++ b/src/common/proxy65_manager.py @@ -15,6 +15,7 @@ ## import socket import struct +import errno import common.xmpp from common import gajim @@ -246,16 +247,18 @@ class HostTester(Socks5, IdleObject): self._recv=self._sock.recv except Exception, ee: (errnum, errstr) = ee - if errnum == 111: - self.on_failure() - return None + if errnum in (errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK): + # still trying to connect + return # win32 needs this - elif errnum != 10056 or self.state != 0: - return None - else: # socket is already connected - self._sock.setblocking(False) - self._send=self._sock.send - self._recv=self._sock.recv + if errnum not in (0, 10056, errno.EISCONN): + # connection failed + self.on_failure() + return + # socket is already connected + self._sock.setblocking(False) + self._send=self._sock.send + self._recv=self._sock.recv self.buff = '' self.state = 1 # connected self.idlequeue.plug_idle(self, True, False)