Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2012-09-19 19:20:45 +0400
committerYann Leboulanger <asterix@lagaule.org>2012-09-19 19:20:45 +0400
commita2b6b68cde0e718bcee595418071269843368a4e (patch)
treed9eb91b53587ad236b7d2cd8dd2c95e2e555c7e1 /src/common/xmpp
parentd530b8ef84ba71bb3f849e6139fe76d741c99e5e (diff)
handle disconnection while doing SASL as a sasl failure rather than a connection error. Fixes #3343
Diffstat (limited to 'src/common/xmpp')
-rw-r--r--src/common/xmpp/client_nb.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/common/xmpp/client_nb.py b/src/common/xmpp/client_nb.py
index 70ebbc6da..6d4b39ea0 100644
--- a/src/common/xmpp/client_nb.py
+++ b/src/common/xmpp/client_nb.py
@@ -85,6 +85,7 @@ class NonBlockingClient:
log.info('Disconnecting NBClient: %s' % message)
+ sasl_failed = False
if 'NonBlockingRoster' in self.__dict__:
self.NonBlockingRoster.PlugOut()
if 'NonBlockingBind' in self.__dict__:
@@ -92,7 +93,12 @@ class NonBlockingClient:
if 'NonBlockingNonSASL' in self.__dict__:
self.NonBlockingNonSASL.PlugOut()
if 'SASL' in self.__dict__:
- self.SASL.PlugOut()
+ if self.SASL.startsasl == 'failure-in-process':
+ sasl_failed = True
+ self.SASL.startsasl = 'failure'
+ self._on_start_sasl()
+ else:
+ self.SASL.PlugOut()
if 'NonBlockingTCP' in self.__dict__:
self.NonBlockingTCP.PlugOut()
if 'NonBlockingHTTP' in self.__dict__:
@@ -111,7 +117,9 @@ class NonBlockingClient:
self.disconnecting = True
log.debug('Client disconnected..')
- if connected == '':
+ # Don't call any callback when it's a SASL failure.
+ # SASL handler is already called
+ if connected == '' and not sasl_failed:
# if we're disconnecting before connection to XMPP sever is opened,
# we don't call disconnect handlers but on_connect_failure callback
if self.proxy:
@@ -121,7 +129,7 @@ class NonBlockingClient:
else:
log.debug('calling on_connect_failure cb')
self.on_connect_failure()
- else:
+ elif not sasl_failed:
# we are connected to XMPP server
if not stream_started:
# if error occur before XML stream was opened, e.g. no response on