fix deprecation warnings; add debug info
authorKali Kaneko <kali@leap.se>
Thu, 11 Apr 2013 10:36:28 +0000 (19:36 +0900)
committerKali Kaneko <kali@leap.se>
Thu, 11 Apr 2013 10:40:18 +0000 (19:40 +0900)
changes/bug_fix-deprecation-warning [new file with mode: 0644]
src/leap/common/events/component.py
src/leap/common/events/daemon.py
src/leap/common/events/server.py

diff --git a/changes/bug_fix-deprecation-warning b/changes/bug_fix-deprecation-warning
new file mode 100644 (file)
index 0000000..ac58117
--- /dev/null
@@ -0,0 +1 @@
+  o Fix deprecation warnings
index 4fcd6e7..bec1898 100644 (file)
@@ -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)
index 09f3c2f..d2c7b9b 100644 (file)
@@ -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
 
index e2365cb..16c6513 100644 (file)
@@ -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)