Fix event handler de/registering

This commit is contained in:
Andrew Resch 2009-04-19 19:50:12 +00:00
parent b60dc2d4ca
commit 2589baf0e2
1 changed files with 6 additions and 4 deletions

View File

@ -321,9 +321,11 @@ class DaemonSSLProxy(DaemonProxy):
if event not in self.__factory.event_handlers:
# This is a new event to handle, so we need to tell the daemon
# 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])
# 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)
def deregister_event_handler(self, event, handler):
@ -334,8 +336,8 @@ class DaemonSSLProxy(DaemonProxy):
:param handler: function, the function registered
"""
if event in self.event_handlers and handler in self.event_handlers[event]:
self.event_handlers[event].remove(handler)
if event in self.__factory.event_handlers and handler in self.__factory.event_handlers[event]:
self.__factory.event_handlers[event].remove(handler)
def __rpcError(self, error_data):
"""