Commit abc42a9b authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Merge branch 'smacks_rev_1.5' into 'master'

Smacks rev 1.5.2

See merge request !5
parents ed4a9e05 e30565e2
from .protocol import Acks from .protocol import Acks
from .protocol import NS_STREAM_MGMT from .protocol import NS_STREAM_MGMT
from .transports_nb import CONNECTED, CONNECTING, DISCONNECTED, DISCONNECTING
import logging import logging
log = logging.getLogger('nbxmpp.smacks') log = logging.getLogger('nbxmpp.smacks')
...@@ -105,6 +106,14 @@ class Smacks(object): ...@@ -105,6 +106,14 @@ class Smacks(object):
ack.buildAnswer(self.in_h) ack.buildAnswer(self.in_h)
self._owner.Connection.send(ack, False) self._owner.Connection.send(ack, False)
def send_closing_ack(self):
if self._owner.Connection.get_state() != DISCONNECTING:
log.error("Not allowed to send closing smacks ack when not disconnecting!")
return
ack = Acks()
ack.buildAnswer(self.in_h)
self._owner.Connection.send(ack, True)
def request_ack(self): def request_ack(self):
r = Acks() r = Acks()
r.buildRequest() r.buildRequest()
......
...@@ -304,6 +304,8 @@ class NonBlockingTransport(PlugIn): ...@@ -304,6 +304,8 @@ class NonBlockingTransport(PlugIn):
# FIXME: where and why does this need to be called # FIXME: where and why does this need to be called
def start_disconnect(self): def start_disconnect(self):
self.set_state(DISCONNECTING) self.set_state(DISCONNECTING)
if self._owner._caller.sm and self._owner._caller.sm.enabled:
self._owner._caller.sm.send_closing_ack()
class NonBlockingTCP(NonBlockingTransport, IdleObject): class NonBlockingTCP(NonBlockingTransport, IdleObject):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment