Browse Source

aiorpcx: require 0.11.0

patch-2
Neil Booth 6 years ago
parent
commit
06ee804a30
  1. 4
      electrumx/server/controller.py
  2. 11
      electrumx/server/session.py
  3. 2
      setup.py

4
electrumx/server/controller.py

@ -82,8 +82,8 @@ class Controller(ServerBase):
'''Start the RPC server and wait for the mempool to synchronize. Then '''Start the RPC server and wait for the mempool to synchronize. Then
start serving external clients. start serving external clients.
''' '''
if not (0, 10, 4) <= aiorpcx_version < (0, 11): if not (0, 11, 0) <= aiorpcx_version < (0, 12):
raise RuntimeError('aiorpcX version 0.10.x, x >= 4, required') raise RuntimeError('aiorpcX version 0.11.x is required')
env = self.env env = self.env
min_str, max_str = env.coin.SESSIONCLS.protocol_min_max_strings() min_str, max_str = env.coin.SESSIONCLS.protocol_min_max_strings()

11
electrumx/server/session.py

@ -262,8 +262,9 @@ class SessionManager(object):
for session in stale_sessions) for session in stale_sessions)
self.logger.info(f'closing stale connections {text}') self.logger.info(f'closing stale connections {text}')
# Give the sockets some time to close gracefully # Give the sockets some time to close gracefully
async with TaskGroup() as group:
for session in stale_sessions: for session in stale_sessions:
await session.spawn(session.close()) await group.spawn(session.close())
# Consolidate small groups # Consolidate small groups
bw_limit = self.env.bandwidth_limit bw_limit = self.env.bandwidth_limit
@ -512,10 +513,9 @@ class SessionManager(object):
finally: finally:
# Close servers then sessions # Close servers then sessions
await self._close_servers(list(self.servers.keys())) await self._close_servers(list(self.servers.keys()))
async with TaskGroup() as group:
for session in list(self.sessions): for session in list(self.sessions):
await session.spawn(session.close(force_after=1)) await group.spawn(session.close(force_after=1))
for session in list(self.sessions):
await session.closed_event.wait()
def session_count(self): def session_count(self):
'''The number of connections that we've sent something to.''' '''The number of connections that we've sent something to.'''
@ -573,8 +573,9 @@ class SessionManager(object):
for hashX in set(hc).intersection(touched): for hashX in set(hc).intersection(touched):
del hc[hashX] del hc[hashX]
async with TaskGroup() as group:
for session in self.sessions: for session in self.sessions:
await session.spawn(session.notify, touched, height_changed) await group.spawn(session.notify, touched, height_changed)
def add_session(self, session): def add_session(self, session):
self.sessions.add(session) self.sessions.add(session)

2
setup.py

@ -14,7 +14,7 @@ setuptools.setup(
# "xevan_hash" package is required to sync Xuez network. # "xevan_hash" package is required to sync Xuez network.
# "groestlcoin_hash" package is required to sync Groestlcoin network. # "groestlcoin_hash" package is required to sync Groestlcoin network.
# "pycryptodomex" package is required to sync SmartCash network. # "pycryptodomex" package is required to sync SmartCash network.
install_requires=['aiorpcX>=0.10.4,<0.11', 'attrs', install_requires=['aiorpcX>=0.11.0,<0.12', 'attrs',
'plyvel', 'pylru', 'aiohttp >= 2'], 'plyvel', 'pylru', 'aiohttp >= 2'],
packages=setuptools.find_packages(include=('electrumx*',)), packages=setuptools.find_packages(include=('electrumx*',)),
description='ElectrumX Server', description='ElectrumX Server',

Loading…
Cancel
Save