threadsafe get_session
[electrum-server.git] / processor.py
index 5ba83ad..4cbaa85 100644 (file)
@@ -143,6 +143,10 @@ class RequestDispatcher(threading.Thread):
         if method in ['server.version']:
             session.version = params[0]
 
+    def get_sessions(self):
+        with self.lock:
+            r = self.sessions[:]
+        return r
 
     def add_session(self, session):
         with self.lock:
@@ -170,6 +174,7 @@ class Session:
         self.address = ''
         self.name = ''
         self.version = 'unknown'
+        self.time = time.time()
         threading.Timer(2, self.info).start()
 
     # Debugging method. Doesn't need to be threadsafe.