mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-13 21:14:55 +00:00
Fix event handler de/registering
This commit is contained in:
parent
b60dc2d4ca
commit
2589baf0e2
@ -321,9 +321,11 @@ class DaemonSSLProxy(DaemonProxy):
|
|||||||
if event not in self.__factory.event_handlers:
|
if event not in self.__factory.event_handlers:
|
||||||
# This is a new event to handle, so we need to tell the daemon
|
# This is a new event to handle, so we need to tell the daemon
|
||||||
# that we're interested in receiving this type of event
|
# that we're interested in receiving this type of event
|
||||||
self.event_handlers[event] = []
|
self.__factory.event_handlers[event] = []
|
||||||
self.call("daemon.set_event_interest", [event])
|
self.call("daemon.set_event_interest", [event])
|
||||||
|
|
||||||
|
# Only add the handler if it's not already registered
|
||||||
|
if handler not in self.__factory.event_handlers[event]:
|
||||||
self.__factory.event_handlers[event].append(handler)
|
self.__factory.event_handlers[event].append(handler)
|
||||||
|
|
||||||
def deregister_event_handler(self, event, handler):
|
def deregister_event_handler(self, event, handler):
|
||||||
@ -334,8 +336,8 @@ class DaemonSSLProxy(DaemonProxy):
|
|||||||
:param handler: function, the function registered
|
:param handler: function, the function registered
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if event in self.event_handlers and handler in self.event_handlers[event]:
|
if event in self.__factory.event_handlers and handler in self.__factory.event_handlers[event]:
|
||||||
self.event_handlers[event].remove(handler)
|
self.__factory.event_handlers[event].remove(handler)
|
||||||
|
|
||||||
def __rpcError(self, error_data):
|
def __rpcError(self, error_data):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user