3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 13:09:23 +01:00

PyLinkNetworkCore: copy world.hooks before iterating

This fixes a race condition where the order of PRIVMSG handlers could be changed as 'load <plugin>' runs, causing the load command to be processed multiple times.
This commit is contained in:
James Lu 2017-09-23 13:39:43 -07:00
parent 2535aa145f
commit 113bfcba9d

View File

@ -233,7 +233,7 @@ class PyLinkNetworkCore(structures.DeprecatedAttributesObject, structures.CamelC
command, hook_cmd)
# Iterate over registered hook functions, catching errors accordingly.
for hook_pair in world.hooks[hook_cmd]:
for hook_pair in world.hooks[hook_cmd].copy():
hook_func = hook_pair[1]
try:
log.debug('(%s) Calling hook function %s from plugin "%s"', self.name,