From: ThomasV Date: Tue, 5 Jun 2012 17:19:52 +0000 (+0400) Subject: display session type X-Git-Url: https://git.novaco.in/?a=commitdiff_plain;h=f67ae92c742e2583f61684f15899e973d45dc804;hp=3051f46df11fc6c9ebe321c9ef6d726e65310129;p=electrum-server.git display session type --- diff --git a/backends/irc/__init__.py b/backends/irc/__init__.py index 9a53402..1f8ca10 100644 --- a/backends/irc/__init__.py +++ b/backends/irc/__init__.py @@ -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)}, diff --git a/server.py b/server.py index 5846fba..1111521 100755 --- 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() diff --git a/transports/stratum_http.py b/transports/stratum_http.py index 8118478..6c8d501 100644 --- a/transports/stratum_http.py +++ b/transports/stratum_http.py @@ -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) diff --git a/transports/stratum_tcp.py b/transports/stratum_tcp.py index b7176b9..4bcefab 100644 --- a/transports/stratum_tcp.py +++ b/transports/stratum_tcp.py @@ -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():