handle disconnection while doing SASL as a sasl failure rather than a connection error. Fixes #3343
This commit is contained in:
parent
d530b8ef84
commit
a2b6b68cde
|
@ -85,6 +85,7 @@ class NonBlockingClient:
|
||||||
|
|
||||||
log.info('Disconnecting NBClient: %s' % message)
|
log.info('Disconnecting NBClient: %s' % message)
|
||||||
|
|
||||||
|
sasl_failed = False
|
||||||
if 'NonBlockingRoster' in self.__dict__:
|
if 'NonBlockingRoster' in self.__dict__:
|
||||||
self.NonBlockingRoster.PlugOut()
|
self.NonBlockingRoster.PlugOut()
|
||||||
if 'NonBlockingBind' in self.__dict__:
|
if 'NonBlockingBind' in self.__dict__:
|
||||||
|
@ -92,6 +93,11 @@ class NonBlockingClient:
|
||||||
if 'NonBlockingNonSASL' in self.__dict__:
|
if 'NonBlockingNonSASL' in self.__dict__:
|
||||||
self.NonBlockingNonSASL.PlugOut()
|
self.NonBlockingNonSASL.PlugOut()
|
||||||
if 'SASL' in self.__dict__:
|
if 'SASL' in self.__dict__:
|
||||||
|
if self.SASL.startsasl == 'failure-in-process':
|
||||||
|
sasl_failed = True
|
||||||
|
self.SASL.startsasl = 'failure'
|
||||||
|
self._on_start_sasl()
|
||||||
|
else:
|
||||||
self.SASL.PlugOut()
|
self.SASL.PlugOut()
|
||||||
if 'NonBlockingTCP' in self.__dict__:
|
if 'NonBlockingTCP' in self.__dict__:
|
||||||
self.NonBlockingTCP.PlugOut()
|
self.NonBlockingTCP.PlugOut()
|
||||||
|
@ -111,7 +117,9 @@ class NonBlockingClient:
|
||||||
self.disconnecting = True
|
self.disconnecting = True
|
||||||
|
|
||||||
log.debug('Client disconnected..')
|
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,
|
# if we're disconnecting before connection to XMPP sever is opened,
|
||||||
# we don't call disconnect handlers but on_connect_failure callback
|
# we don't call disconnect handlers but on_connect_failure callback
|
||||||
if self.proxy:
|
if self.proxy:
|
||||||
|
@ -121,7 +129,7 @@ class NonBlockingClient:
|
||||||
else:
|
else:
|
||||||
log.debug('calling on_connect_failure cb')
|
log.debug('calling on_connect_failure cb')
|
||||||
self.on_connect_failure()
|
self.on_connect_failure()
|
||||||
else:
|
elif not sasl_failed:
|
||||||
# we are connected to XMPP server
|
# we are connected to XMPP server
|
||||||
if not stream_started:
|
if not stream_started:
|
||||||
# if error occur before XML stream was opened, e.g. no response on
|
# if error occur before XML stream was opened, e.g. no response on
|
||||||
|
|
Loading…
Reference in New Issue