xmlstream.disconnect: add compat behaviour, set wait to default 2.0 when True is passed. Update documentation

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet
2019-04-24 23:22:45 +01:00
parent 2638ba2744
commit 4435c81d77
2 changed files with 14 additions and 7 deletions

View File

@@ -478,6 +478,13 @@ class XMLStream(asyncio.BaseProtocol):
:param wait: Time to wait for a response from the server.
"""
# Compat: docs/getting_started/sendlogout.rst has been promoting
# `disconnect(wait=True)` for ages. This doesn't mean anything to the
# schedule call below. It would fortunately be converted to `1` later
# down the call chain. Praise the implicit casts lord.
if wait == True:
wait = 2.0
self.disconnect_reason = reason
self.cancel_connection_attempt()
if self.transport: