display session type
authorThomasV <thomasv@gitorious>
Tue, 5 Jun 2012 17:19:52 +0000 (21:19 +0400)
committerThomasV <thomasv@gitorious>
Tue, 5 Jun 2012 17:19:52 +0000 (21:19 +0400)
backends/irc/__init__.py
server.py
transports/stratum_http.py
transports/stratum_tcp.py

index 9a53402..1f8ca10 100644 (file)
@@ -119,6 +119,7 @@ class ServerProcessor(Processor):
 
         elif method == 'server.info':
             result = map(lambda s: { "time":s.time, 
+                                     "name":s.name,
                                      "address":s.address, 
                                      "version":s.version, 
                                      "subscriptions":len(s.subscriptions)}, 
index 5846fba..1111521 100755 (executable)
--- a/server.py
+++ b/server.py
@@ -73,8 +73,13 @@ def run_rpc_command(command, stratum_tcp_port):
     if command == 'stop': print r
     elif command == 'info': 
         now = time.time()
+        print 'type           address   sub  version  time' 
         for item in r:
-            print '%15s   %3s  %7s  %.2f'%( item.get('address'), item.get('subscriptions'), item.get('version'), (now - item.get('time')) )
+            print '%4s   %15s   %3s  %7s  %.2f'%( item.get('name'), 
+                                                  item.get('address'), 
+                                                  item.get('subscriptions'), 
+                                                  item.get('version'), 
+                                                  (now - item.get('time')) )
 
 if __name__ == '__main__':
     config = create_config()
index 8118478..6c8d501 100644 (file)
@@ -285,7 +285,7 @@ class HttpSession(Session):
         Session.__init__(self)
         self.pending_responses = Queue.Queue()
         self.address = session_id
-        self.name = "HTTP session"
+        self.name = "HTTP"
 
     def send_response(self, response):
         raw_response = json.dumps(response)
index b7176b9..4bcefab 100644 (file)
@@ -12,7 +12,7 @@ class TcpSession(Session):
         Session.__init__(self)
         self._connection = connection
         self.address = address[0]
-        self.name = "TCP session"
+        self.name = "TCP"
 
     def connection(self):
         if self.stopped():