Browse Source

Merge branch 'develop'

master 0.8.11
Neil Booth 8 years ago
parent
commit
792f58fb5d
  1. 6
      RELEASE-NOTES
  2. 25
      server/protocol.py
  3. 2
      server/version.py

6
RELEASE-NOTES

@ -1,3 +1,9 @@
version 0.8.11
--------------
- catch harmless socket exception
- show session count in groups RPC call
version 0.8.10 version 0.8.10
-------------- --------------

25
server/protocol.py

@ -471,6 +471,7 @@ class ServerManager(util.LoggedClass):
await asyncio.sleep(2) await asyncio.sleep(2)
self.logger.info('{:,d} sessions remaining' self.logger.info('{:,d} sessions remaining'
.format(len(self.sessions))) .format(len(self.sessions)))
await asyncio.sleep(1)
def add_session(self, session): def add_session(self, session):
# Some connections are acknowledged after the servers are closed # Some connections are acknowledged after the servers are closed
@ -514,14 +515,18 @@ class ServerManager(util.LoggedClass):
for session in self.sessions: for session in self.sessions:
if session.is_closing(): if session.is_closing():
if session.stop <= shutdown_cutoff and session.socket: if session.stop <= shutdown_cutoff and session.socket:
# Should trigger a call to connection_lost very soon try:
session.socket.shutdown(socket.SHUT_RDWR) # Force shut down - a call to connection_lost
else: # should come soon after
if session.last_recv < stale_cutoff: session.socket.shutdown(socket.SHUT_RDWR)
self.close_session(session) except socket.error:
stale.append(session.id_) pass
elif session.last_recv < stale_cutoff:
self.close_session(session)
stale.append(session.id_)
if stale: if stale:
self.logger.info('closing stale connections {}'.format(stale)) self.logger.info('closing stale connections {}'.format(stale))
# Clear out empty groups # Clear out empty groups
for key in [k for k, v in self.groups.items() if not v]: for key in [k for k, v in self.groups.items() if not v]:
del self.groups[key] del self.groups[key]
@ -567,13 +572,14 @@ class ServerManager(util.LoggedClass):
data is the return value of rpc_groups().''' data is the return value of rpc_groups().'''
fmt = ('{:<6} {:>9} {:>6} {:>6} {:>8}' fmt = ('{:<6} {:>9} {:>9} {:>6} {:>6} {:>8}'
'{:>7} {:>9} {:>7} {:>9}') '{:>7} {:>9} {:>7} {:>9}')
yield fmt.format('ID', 'Bw Qta KB', 'Reqs', 'Txs', 'Subs', yield fmt.format('ID', 'Sessions', 'Bw Qta KB', 'Reqs', 'Txs', 'Subs',
'Recv', 'Recv KB', 'Sent', 'Sent KB') 'Recv', 'Recv KB', 'Sent', 'Sent KB')
for (id_, bandwidth, reqs, txs_sent, subs, for (id_, session_count, bandwidth, reqs, txs_sent, subs,
recv_count, recv_size, send_count, send_size) in data: recv_count, recv_size, send_count, send_size) in data:
yield fmt.format(id_, yield fmt.format(id_,
'{:,d}'.format(session_count),
'{:,d}'.format(bandwidth // 1024), '{:,d}'.format(bandwidth // 1024),
'{:,d}'.format(reqs), '{:,d}'.format(reqs),
'{:,d}'.format(txs_sent), '{:,d}'.format(txs_sent),
@ -589,6 +595,7 @@ class ServerManager(util.LoggedClass):
for group_id in sorted(self.groups.keys()): for group_id in sorted(self.groups.keys()):
sessions = self.groups[group_id] sessions = self.groups[group_id]
result.append([group_id, result.append([group_id,
len(sessions),
sum(s.bandwidth_used for s in sessions), sum(s.bandwidth_used for s in sessions),
sum(s.requests_remaining() for s in sessions), sum(s.requests_remaining() for s in sessions),
sum(s.txs_sent for s in sessions), sum(s.txs_sent for s in sessions),

2
server/version.py

@ -1 +1 @@
VERSION = "ElectrumX 0.8.10" VERSION = "ElectrumX 0.8.11"

Loading…
Cancel
Save