disconnect after stream end tag, unregister
two more handlers
This commit is contained in:
parent
a4b37a54a1
commit
b3de43ae3f
|
@ -80,6 +80,7 @@ class PlugIn:
|
|||
for method in self._old_owners_methods: self._owner.__dict__[method.__name__]=method
|
||||
del self._owner.__dict__[self.__class__.__name__]
|
||||
if self.__class__.__dict__.has_key('plugout'): return self.plugout()
|
||||
del self._owner
|
||||
|
||||
def DEBUG(self,text,severity='info'):
|
||||
""" Feed a provided debug line to main instance's debug facility along with our ID string. """
|
||||
|
|
|
@ -78,6 +78,10 @@ class NBCommonClient(CommonClient):
|
|||
for i in self.disconnect_handlers:
|
||||
i()
|
||||
self.disconnect_handlers.reverse()
|
||||
if self.__dict__.has_key('NonBlockingRoster'):
|
||||
self.NonBlockingRoster.PlugOut()
|
||||
if self.__dict__.has_key('NonBlockingBind'):
|
||||
self.NonBlockingBind.PlugOut()
|
||||
if self.__dict__.has_key('NonBlockingNonSASL'):
|
||||
self.NonBlockingNonSASL.PlugOut()
|
||||
if self.__dict__.has_key('SASL'):
|
||||
|
|
|
@ -126,6 +126,10 @@ class Dispatcher(PlugIn):
|
|||
raise _pendingException[0], _pendingException[1], _pendingException[2]
|
||||
try:
|
||||
self.Stream.Parse(data)
|
||||
# end stream:stream tag received
|
||||
if self.Stream._NodeBuilder__depth == 0:
|
||||
self._owner.Connection.disconnect()
|
||||
return 0
|
||||
except ExpatError:
|
||||
sys.exc_clear()
|
||||
self._owner.Connection.pollend()
|
||||
|
|
|
@ -236,7 +236,7 @@ class NonBlockingTcp(PlugIn, IdleObject):
|
|||
self.renew_send_timeout()
|
||||
if self.on_receive:
|
||||
if received.strip():
|
||||
self.DEBUG(received,'got')
|
||||
self.DEBUG(received, 'got')
|
||||
if hasattr(self._owner, 'Dispatcher'):
|
||||
self._owner.Dispatcher.Event('', DATA_RECEIVED, received)
|
||||
self.on_receive(received)
|
||||
|
@ -258,6 +258,7 @@ class NonBlockingTcp(PlugIn, IdleObject):
|
|||
self.sendbuff = self.sendbuff[send_count:]
|
||||
if not self.sendbuff and not self.sendqueue:
|
||||
if self.state < 0:
|
||||
self.idlequeue.unplug_idle(self.fd)
|
||||
self._on_send()
|
||||
self.disconnect()
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue