From 31a9f6fb347e0fbf26a1ace29f6661562834950c Mon Sep 17 00:00:00 2001 From: Tom Goff Date: Wed, 12 Oct 2016 15:55:30 +0000 Subject: [PATCH] daemon: Use a set to store broker handlers. --- daemon/core/broker.py | 2 +- daemon/core/emane/emane.py | 2 +- daemon/core/mobility.py | 2 +- daemon/core/sdt.py | 2 +- daemon/core/session.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/daemon/core/broker.py b/daemon/core/broker.py index 7aa2e457..8b949241 100644 --- a/daemon/core/broker.py +++ b/daemon/core/broker.py @@ -54,7 +54,7 @@ class CoreBroker(ConfigurableManager): # list of node numbers that are PhysicalNode nodes self.phys = [] # allows for other message handlers to process API messages (e.g. EMANE) - self.handlers = () + self.handlers = set() # dict with tunnel key to tunnel device mapping self.tunnels = {} self.dorecvloop = False diff --git a/daemon/core/emane/emane.py b/daemon/core/emane/emane.py index 45086a15..fcc299aa 100644 --- a/daemon/core/emane/emane.py +++ b/daemon/core/emane/emane.py @@ -67,7 +67,7 @@ class Emane(ConfigurableManager): self.logversion() # model for global EMANE configuration options self.emane_config = EmaneGlobalModel(session, None, self.verbose) - session.broker.handlers += (self.handledistributed, ) + session.broker.handlers.add(self.handledistributed) self.loadmodels() self.service = None diff --git a/daemon/core/mobility.py b/daemon/core/mobility.py index 2dfb5e8e..3da4dab0 100644 --- a/daemon/core/mobility.py +++ b/daemon/core/mobility.py @@ -33,7 +33,7 @@ class MobilityManager(ConfigurableManager): # dummy node objects for tracking position of nodes on other servers self.phys = {} self.physnets = {} - self.session.broker.handlers += (self.physnodehandlelink, ) + self.session.broker.handlers.add(self.physnodehandlelink) self.register() def startup(self, nodenums=None): diff --git a/daemon/core/sdt.py b/daemon/core/sdt.py index 7f8008d8..2eeb0db2 100644 --- a/daemon/core/sdt.py +++ b/daemon/core/sdt.py @@ -50,7 +50,7 @@ class Sdt(object): # node information for remote nodes not in session._objs # local nodes also appear here since their obj may not exist yet self.remotes = {} - session.broker.handlers += (self.handledistributed, ) + session.broker.handlers.add(self.handledistributed) def is_enabled(self): ''' Check for 'enablesdt' session option. Return False by default if diff --git a/daemon/core/session.py b/daemon/core/session.py index 85fb49d3..8d99f8e7 100644 --- a/daemon/core/session.py +++ b/daemon/core/session.py @@ -1132,7 +1132,7 @@ class SessionConfig(ConfigurableManager, Configurable): def __init__(self, session): ConfigurableManager.__init__(self, session) - session.broker.handlers += (self.handledistributed, ) + session.broker.handlers.add(self.handledistributed) self.reset() def reset(self):