Rename RPC_SIGNAL to RPC_EVENT and fix receiving multiple events

This commit is contained in:
Andrew Resch 2009-02-08 23:25:57 +00:00
parent e96b4c4f58
commit 8ee7bf9983
2 changed files with 6 additions and 6 deletions

View File

@ -44,7 +44,7 @@ from deluge.core.authmanager import AUTH_LEVEL_NONE, AUTH_LEVEL_DEFAULT
RPC_RESPONSE = 1 RPC_RESPONSE = 1
RPC_ERROR = 2 RPC_ERROR = 2
RPC_SIGNAL = 3 RPC_EVENT = 3
def export(auth_level=AUTH_LEVEL_DEFAULT): def export(auth_level=AUTH_LEVEL_DEFAULT):
""" """
@ -356,9 +356,9 @@ class RPCServer(component.Component):
for session_id, interest in self.factory.interested_events.iteritems(): for session_id, interest in self.factory.interested_events.iteritems():
if event.name in interest: if event.name in interest:
log.debug("Emit Event: %s %s", event.name, event.args) log.debug("Emit Event: %s %s", event.name, event.args)
# This session is interested so send a RPC_SIGNAL # This session is interested so send a RPC_EVENT
self.factory.session_protocols[session_id].sendData( self.factory.session_protocols[session_id].sendData(
(RPC_SIGNAL, event.name, event.args) (RPC_EVENT, event.name, event.args)
) )
def __generate_ssl_keys(self): def __generate_ssl_keys(self):

View File

@ -38,7 +38,7 @@ else:
RPC_RESPONSE = 1 RPC_RESPONSE = 1
RPC_ERROR = 2 RPC_ERROR = 2
RPC_SIGNAL = 3 RPC_EVENT = 3
def format_kwargs(kwargs): def format_kwargs(kwargs):
return ", ".join([key + "=" + str(value) for key, value in kwargs.items()]) return ", ".join([key + "=" + str(value) for key, value in kwargs.items()])
@ -144,14 +144,14 @@ class DelugeRPCProtocol(Protocol):
message_type = request[0] message_type = request[0]
if message_type == RPC_SIGNAL: if message_type == RPC_EVENT:
event = request[1] event = request[1]
# A RPCSignal was received from the daemon so run any handlers # A RPCSignal was received from the daemon so run any handlers
# associated with it. # associated with it.
if event in self.factory.event_handlers: if event in self.factory.event_handlers:
for handler in self.factory.event_handlers[event]: for handler in self.factory.event_handlers[event]:
reactor.callLater(0, handler, *request[2]) reactor.callLater(0, handler, *request[2])
return continue
request_id = request[1] request_id = request[1]