Commit de353713 authored by anonym's avatar anonym
Browse files

tor-controlport-filter: make each event callback unique.

So that unsubscribing actually works as intended. OTOH, I think the old
way actually worked since we unsubscribe the same event_cb the correct
amount of times (but the order is undefined, subject to the
implementation of stem's remove_event_listener()), but let's do it
properly instead.
parent 0fd98bda
......@@ -261,10 +261,11 @@ def handle_controlport_session(controller, readh, writeh, allowed_commands, allo
rule = allowed_events[event] or {}
if not rule.get('suppress', False) or \
global_args.disable_filtering:
event_cb_instance = lambda event: event_cb(event)
controller.add_event_listener(
event_cb, getattr(stem.control.EventType, event)
event_cb_instance, getattr(stem.control.EventType, event)
)
subscribed_event_listeners.append(event_cb)
subscribed_event_listeners.append(event_cb_instance)
respond("250 OK")
# SETCONF can take multiple assignments, but let's allow
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment