diff options
Diffstat (limited to 'src/leap/common')
-rw-r--r-- | src/leap/common/events/component.py | 5 | ||||
-rw-r--r-- | src/leap/common/events/daemon.py | 2 | ||||
-rw-r--r-- | src/leap/common/events/server.py | 8 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/leap/common/events/component.py b/src/leap/common/events/component.py index 4fcd6e7..bec1898 100644 --- a/src/leap/common/events/component.py +++ b/src/leap/common/events/component.py @@ -66,10 +66,13 @@ def ensure_component_daemon(): @return: the daemon instance @rtype: EventsComponentDaemon """ - daemon = EventsComponentDaemon.ensure(0) import time + daemon = EventsComponentDaemon.ensure(0) + logger.debug('ensure component daemon') + # Because we use a random port we want to wait until a port is assigned to # local component daemon. + while not (EventsComponentDaemon.get_instance() and EventsComponentDaemon.get_instance().get_port()): time.sleep(0.1) diff --git a/src/leap/common/events/daemon.py b/src/leap/common/events/daemon.py index 09f3c2f..d2c7b9b 100644 --- a/src/leap/common/events/daemon.py +++ b/src/leap/common/events/daemon.py @@ -99,7 +99,7 @@ class EventsSingletonDaemon(threading.Thread): % len(args)) if cls.__instance is None: cls.__instance = object.__new__( - EventsSingletonDaemon, *args, **kwargs) + EventsSingletonDaemon) cls.__initialize(cls.__instance, args[0], args[1]) return cls.__instance diff --git a/src/leap/common/events/server.py b/src/leap/common/events/server.py index e2365cb..16c6513 100644 --- a/src/leap/common/events/server.py +++ b/src/leap/common/events/server.py @@ -14,7 +14,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. - """ A server for the events mechanism. @@ -25,10 +24,7 @@ A server can receive different kinds of requests from components: 2. Signal request: redistribute the signal to registered components. """ - - import logging -import sets import socket @@ -95,9 +91,11 @@ class EventsServerService(proto.EventsServerService): logger.info("Received registration request: %s" % str(request)) # add component port to signal list if request.event not in registered_components: - registered_components[request.event] = sets.Set() + registered_components[request.event] = set([]) registered_components[request.event].add(request.port) # send response back to component + + logger.debug('sending response back') response = proto.EventResponse() response.status = proto.EventResponse.OK done.run(response) |