summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2016-09-30 20:59:31 +0200
committermathieui <mathieui@mathieui.net>2016-09-30 20:59:31 +0200
commit0c63a4bbdafcb557430e02f774dc88c5f2a974c1 (patch)
tree96f3b61c44da1cb618aeb4e20215d88bbd24cf9c
parente4696e0471bfad0dd0373ca635c026f07ba1ca3f (diff)
downloadslixmpp-0c63a4bbdafcb557430e02f774dc88c5f2a974c1.tar.gz
slixmpp-0c63a4bbdafcb557430e02f774dc88c5f2a974c1.tar.bz2
slixmpp-0c63a4bbdafcb557430e02f774dc88c5f2a974c1.tar.xz
slixmpp-0c63a4bbdafcb557430e02f774dc88c5f2a974c1.zip
Fix #3226 (unicity of scheduled event names)
Thanks tchiroux for raising the issue and providing the fix as well.
-rw-r--r--slixmpp/xmlstream/xmlstream.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py
index 686dfde8..c491746d 100644
--- a/slixmpp/xmlstream/xmlstream.py
+++ b/slixmpp/xmlstream/xmlstream.py
@@ -760,6 +760,9 @@ class XMLStream(asyncio.BaseProtocol):
:param repeat: Flag indicating if the scheduled event should
be reset and repeat after executing.
"""
+ if name in self.scheduled_events:
+ raise ValueError(
+ "There is already a scheduled event of name: %s" % name)
if seconds is None:
seconds = RESPONSE_TIMEOUT
cb = functools.partial(callback, *args, **kwargs)
@@ -769,7 +772,6 @@ class XMLStream(asyncio.BaseProtocol):
else:
handle = self.loop.call_later(seconds, self._execute_and_unschedule,
name, cb)
-
# Save that handle, so we can just cancel this scheduled event by
# canceling scheduled_events[name]
self.scheduled_events[name] = handle