summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-01-22 22:55:39 +0100
committermathieui <mathieui@mathieui.net>2021-01-22 22:55:39 +0100
commit3f10dfe138ee0be1c25e3e12546facd3a7b58651 (patch)
treea6b74013f3e7e0a5aac1dd9af910930e7cb57421
parentb784b68bcdface791f2a6e0e0a5482096b03ee06 (diff)
downloadslixmpp-3f10dfe138ee0be1c25e3e12546facd3a7b58651.tar.gz
slixmpp-3f10dfe138ee0be1c25e3e12546facd3a7b58651.tar.bz2
slixmpp-3f10dfe138ee0be1c25e3e12546facd3a7b58651.tar.xz
slixmpp-3f10dfe138ee0be1c25e3e12546facd3a7b58651.zip
iq: only update the future if it is not done
-rw-r--r--slixmpp/stanza/iq.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/slixmpp/stanza/iq.py b/slixmpp/stanza/iq.py
index a3f16e2f..0f53425b 100644
--- a/slixmpp/stanza/iq.py
+++ b/slixmpp/stanza/iq.py
@@ -194,9 +194,11 @@ class Iq(RootStanza):
def callback_success(result):
type_ = result['type']
if type_ == 'result':
- future.set_result(result)
+ if not future.done():
+ future.set_result(result)
elif type_ == 'error':
- future.set_exception(IqError(result))
+ if not future.done():
+ future.set_exception(IqError(result))
else:
# Most likely an iq addressed to ourself, rearm the callback.
handler = constr(handler_name,
@@ -212,7 +214,8 @@ class Iq(RootStanza):
callback(result)
def callback_timeout():
- future.set_exception(IqTimeout(self))
+ if not future.done():
+ future.set_exception(IqTimeout(self))
self.stream.remove_handler('IqCallback_%s' % self['id'])
if timeout_callback is not None:
timeout_callback(self)