Do not close stream on 0-timeout disconnect, allows 0198 resume

This commit is contained in:
Georg Lukas 2019-03-26 11:02:28 +01:00
parent 7e435b703d
commit bcb90a653e

View File

@ -467,8 +467,8 @@ class XMLStream(asyncio.BaseProtocol):
at most `wait` seconds. After the given number of seconds has at most `wait` seconds. After the given number of seconds has
passed without a response from the serveur, or when the server passed without a response from the serveur, or when the server
successfully responds with a closure of its own stream, abort() is successfully responds with a closure of its own stream, abort() is
called. If wait is 0.0, this is almost equivalent to calling abort() called. If wait is 0.0, this will call abort() directly without closing
directly. the stream.
Does nothing if we are not connected. Does nothing if we are not connected.
@ -478,6 +478,7 @@ class XMLStream(asyncio.BaseProtocol):
self.disconnect_reason = reason self.disconnect_reason = reason
self.cancel_connection_attempt() self.cancel_connection_attempt()
if self.transport: if self.transport:
if wait > 0.0:
self.send_raw(self.stream_footer) self.send_raw(self.stream_footer)
self.schedule('Disconnect wait', wait, self.schedule('Disconnect wait', wait,
self.abort, repeat=False) self.abort, repeat=False)