[Laurent Sartran] catch exception when SSL connection is reset during handshake

This commit is contained in:
Nikos Kouremenos 2005-09-01 17:44:57 +00:00
parent cd0e35ead5
commit d26696bbe5
2 changed files with 8 additions and 4 deletions

View File

@ -1240,7 +1240,6 @@ class Connection:
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 @@ class Connection:
_('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)

View File

@ -21,6 +21,7 @@ examples of xmpppy structures usage.
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 @@ class CommonClient:
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