Fix calling 'set_event_interest' when registering a handler after connecting

This commit is contained in:
Andrew Resch 2009-04-24 22:50:44 +00:00
parent 42242efe66
commit b2626ea6aa
1 changed files with 3 additions and 2 deletions

View File

@ -322,6 +322,7 @@ class DaemonSSLProxy(DaemonProxy):
# 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.__factory.event_handlers[event] = [] self.__factory.event_handlers[event] = []
if self.connected:
self.call("daemon.set_event_interest", [event]) self.call("daemon.set_event_interest", [event])
# Only add the handler if it's not already registered # Only add the handler if it's not already registered
@ -498,7 +499,7 @@ class Client(object):
import common import common
username, password = common.get_localhost_auth() username, password = common.get_localhost_auth()
self._daemon_proxy = DaemonSSLProxy(self.__event_handlers) self._daemon_proxy = DaemonSSLProxy(dict(self.__event_handlers))
self._daemon_proxy.set_disconnect_callback(self.__on_disconnect) self._daemon_proxy.set_disconnect_callback(self.__on_disconnect)
d = self._daemon_proxy.connect(host, port, username, password) d = self._daemon_proxy.connect(host, port, username, password)
return d return d