Browse Source

Merge branch 'RPC' into develop

master
Neil Booth 8 years ago
parent
commit
a4750f0474
  1. 5
      lib/jsonrpc.py
  2. 10
      server/protocol.py

5
lib/jsonrpc.py

@ -177,7 +177,10 @@ class JSONRPC(asyncio.Protocol, LoggedClass):
return 'unknown'
if for_log and self.anon_logs:
return 'xx.xx.xx.xx:xx'
return '{}:{}'.format(self.peer_info[0], self.peer_info[1])
if ':' in self.peer_info[0]:
return '[{}]:{}'.format(self.peer_info[0], self.peer_info[1])
else:
return '{}:{}'.format(self.peer_info[0], self.peer_info[1])
def connection_made(self, transport):
'''Handle an incoming client connection.'''

10
server/protocol.py

@ -11,6 +11,7 @@
import asyncio
import codecs
import json
import os
import ssl
import time
import traceback
@ -224,10 +225,9 @@ class ServerManager(util.LoggedClass):
async def start_servers(self, caught_up):
'''Start RPC, TCP and SSL servers once caught up.'''
await caught_up.wait()
if self.env.rpc_port is not None:
await self.start_server('RPC', 'localhost', self.env.rpc_port)
await caught_up.wait()
await self.start_external_servers()
async def start_external_servers(self):
@ -408,16 +408,18 @@ class ServerManager(util.LoggedClass):
def server_summary(self):
'''A one-line summary of server state.'''
return {
'blocks': self.bp.db_height,
'daemon_height': self.bp.daemon.cached_height(),
'db_height': self.bp.db_height,
'closing': len([s for s in self.sessions if s.is_closing()]),
'errors': sum(s.error_count for s in self.sessions),
'groups': len(self.groups),
'logged': len([s for s in self.sessions if s.log_me]),
'pid': os.getpid(),
'peers': len(self.irc.peers),
'requests': sum(s.requests_remaining() for s in self.sessions),
'sessions': self.session_count(),
'subs': self.subscription_count,
'txs_sent': self.txs_sent,
'watched': self.subscription_count,
}
@staticmethod

Loading…
Cancel
Save