From d26696bbe54729431be7e1906b2fb00c679c1c45 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos <kourem@gmail.com> Date: Thu, 1 Sep 2005 17:44:57 +0000 Subject: [PATCH] [Laurent Sartran] catch exception when SSL connection is reset during handshake --- src/common/connection.py | 4 ++-- src/common/xmpp/client.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index c0da26dace..2203a4ca05 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1240,7 +1240,6 @@ def connect(self): p = gajim.config.get_per('accounts', self.name, 'custom_port') con_type = con.connect((h, p), proxy = proxy, secure=secur) #FIXME: blocking - self.peerhost = con.get_peerhost() if not con_type: gajim.log.debug("Couldn't connect to %s" % self.name) self.connected = 0 @@ -1249,7 +1248,8 @@ def connect(self): _('Check your connection or try again later'))) return None - gajim.log.debug(_('Connected to server with %s'), con_type) + self.peerhost = con.get_peerhost() + gajim.log.debug(_('Connected to server with %s') % con_type) # notify the gui about con_type self.dispatch('CON_TYPE', con_type) diff --git a/src/common/xmpp/client.py b/src/common/xmpp/client.py index 3bb6323f65..95c4641df9 100644 --- a/src/common/xmpp/client.py +++ b/src/common/xmpp/client.py @@ -21,6 +21,7 @@ These classes can be used for simple applications "AS IS" though. """ +import socket import debug Debug=debug Debug.DEBUGGING_IS_ON=1 @@ -164,8 +165,11 @@ def connect(self,server=None,proxy=None, ssl=None): self._Server,self._Proxy=server,proxy self.connected='tcp' if (ssl is None and self.Connection.getPort() in (5223, 443)) or ssl: - transports.TLS().PlugIn(self,now=1) - self.connected='ssl' + try: + transports.TLS().PlugIn(self,now=1) + self.connected='ssl' + except socket.sslerror: + return dispatcher.Dispatcher().PlugIn(self) while self.Dispatcher.Stream._document_attrs is None: if not self.Process(1): return -- GitLab