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