Browse Source

Move close() up to the base class

Fixes #557
patch-2
Neil Booth 7 years ago
parent
commit
74e6fe416f
  1. 3
      docs/changelog.rst
  2. 14
      electrumx/server/session.py

3
docs/changelog.rst

@ -11,6 +11,8 @@
Version 1.8.1 (in development) Version 1.8.1 (in development)
============================== ==============================
* fix `#557`_
Version 1.8 (06 Aug 2018) Version 1.8 (06 Aug 2018)
========================== ==========================
@ -199,3 +201,4 @@ bitcoincash:qzxpdlt8ehu9ehftw6rqsy2jgfq4nsltxvhrdmdfpn
.. _#523: https://github.com/kyuupichan/electrumx/issues/523 .. _#523: https://github.com/kyuupichan/electrumx/issues/523
.. _#534: https://github.com/kyuupichan/electrumx/issues/534 .. _#534: https://github.com/kyuupichan/electrumx/issues/534
.. _#538: https://github.com/kyuupichan/electrumx/issues/538 .. _#538: https://github.com/kyuupichan/electrumx/issues/538
.. _#557: https://github.com/kyuupichan/electrumx/issues/557

14
electrumx/server/session.py

@ -584,6 +584,13 @@ class SessionBase(ServerSession):
def sub_count(self): def sub_count(self):
return 0 return 0
# FIXME: make this the aiorpcx API for version 0.7
async def close(self, force_after=30):
'''Close the connection and return when closed.'''
async with ignore_after(force_after):
await super().close()
self.abort()
async def handle_request(self, request): async def handle_request(self, request):
'''Handle an incoming request. ElectrumX doesn't receive '''Handle an incoming request. ElectrumX doesn't receive
notifications from client sessions. notifications from client sessions.
@ -645,13 +652,6 @@ class ElectrumX(SessionBase):
def protocol_version_string(self): def protocol_version_string(self):
return util.version_string(self.protocol_tuple) return util.version_string(self.protocol_tuple)
# FIXME: make this the aiorpcx API for version 0.7
async def close(self, force_after=30):
'''Close the connection and return when closed.'''
async with ignore_after(force_after):
await super().close()
self.abort()
async def daemon_request(self, method, *args): async def daemon_request(self, method, *args):
'''Catch a DaemonError and convert it to an RPCError.''' '''Catch a DaemonError and convert it to an RPCError.'''
try: try:

Loading…
Cancel
Save