Browse Source

Merge branch 'master' into devel

patch-2
Neil Booth 7 years ago
parent
commit
70319bb22d
  1. 6
      electrumx/lib/server_base.py
  2. 6
      electrumx/server/peers.py
  3. 6
      electrumx/server/session.py

6
electrumx/lib/server_base.py

@ -23,12 +23,12 @@ class ServerBase(object):
Derived classes are expected to: Derived classes are expected to:
- set PYTHON_MIN_VERSION and SUPPRESS_MESSAGES as appropriate - set PYTHON_MIN_VERSION and SUPPRESS_MESSAGE_REGEX as appropriate
- implement the serve() coroutine, called from the run() method. - implement the serve() coroutine, called from the run() method.
Upon return the event loop runs until the shutdown signal is received. Upon return the event loop runs until the shutdown signal is received.
''' '''
SUPPRESS_MESSAGE_REGEX = re.compile('SSL handshake|Fatal read error on|'
SUPPRESS_MESSAGE_REGEX = re.compile('SSH handshake') 'SSL error in data received')
SUPPRESS_TASK_REGEX = re.compile('accept_connection2') SUPPRESS_TASK_REGEX = re.compile('accept_connection2')
PYTHON_MIN_VERSION = (3, 6) PYTHON_MIN_VERSION = (3, 6)

6
electrumx/server/peers.py

@ -390,9 +390,13 @@ class PeerManager(object):
await group.spawn(forever.wait()) await group.spawn(forever.wait())
await group.spawn(self._detect_proxy()) await group.spawn(self._detect_proxy())
await group.spawn(self._import_peers()) await group.spawn(self._import_peers())
# Consume tasks as they complete # Consume tasks as they complete, logging unexpected failures
async for task in group: async for task in group:
if not task.cancelled():
try:
task.result() task.result()
except Exception:
self.logger.exception('task failed unexpectedly')
def info(self): def info(self):
'''The number of peers.''' '''The number of peers.'''

6
electrumx/server/session.py

@ -683,8 +683,10 @@ class ElectrumX(SessionBase):
# Check mempool hashXs - the status is a function of the # Check mempool hashXs - the status is a function of the
# confirmed state of other transactions. Note: we cannot # confirmed state of other transactions. Note: we cannot
# iterate over mempool_statuses as it changes size. # iterate over mempool_statuses as it changes size.
for hashX in set(self.mempool_statuses): for hashX in tuple(self.mempool_statuses):
old_status = self.mempool_statuses[hashX] # Items can be evicted whilst await-ing below; False
# ensures such hashXs are notified
old_status = self.mempool_statuses.get(hashX, False)
status = await self.address_status(hashX) status = await self.address_status(hashX)
if status != old_status: if status != old_status:
alias = self.hashX_subs[hashX] alias = self.hashX_subs[hashX]

Loading…
Cancel
Save