Commit e30565e2 authored by Thilo Molitor's avatar Thilo Molitor

Send smacks ack directly before stream close

parent 027b7a30
from .protocol import Acks
from .protocol import NS_STREAM_MGMT
from .transports_nb import CONNECTED, CONNECTING, DISCONNECTED, DISCONNECTING
import logging
log = logging.getLogger('nbxmpp.smacks')
......@@ -104,6 +105,14 @@ class Smacks(object):
ack = Acks()
ack.buildAnswer(self.in_h)
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):
r = Acks()
......
......@@ -304,6 +304,8 @@ class NonBlockingTransport(PlugIn):
# FIXME: where and why does this need to be called
def start_disconnect(self):
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):
......
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