3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

Irc: add locking for reply() calls (#437)

This commit is contained in:
James Lu 2017-03-24 00:57:21 -07:00
parent 0f472c8959
commit 99d3780773

View File

@ -62,6 +62,7 @@ class Irc(utils.DeprecatedAttributesObject):
self.connected = threading.Event() self.connected = threading.Event()
self.aborted = threading.Event() self.aborted = threading.Event()
self.reply_lock = threading.Lock()
self.pingTimer = None self.pingTimer = None
@ -558,6 +559,7 @@ class Irc(utils.DeprecatedAttributesObject):
loopback=True): loopback=True):
"""Replies to the last caller in the right context (channel or PM).""" """Replies to the last caller in the right context (channel or PM)."""
with self.reply_lock:
if private is None: if private is None:
# Allow using private replies as the default, if no explicit setting was given. # Allow using private replies as the default, if no explicit setting was given.
private = conf.conf['bot'].get("prefer_private_replies") private = conf.conf['bot'].get("prefer_private_replies")