SomberNight
6 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
1 changed files with
10 additions and
0 deletions
-
electrum/network.py
|
|
@ -221,6 +221,7 @@ class Network(PrintError): |
|
|
|
self.proxy = None |
|
|
|
|
|
|
|
self.asyncio_loop = asyncio.get_event_loop() |
|
|
|
self.asyncio_loop.set_exception_handler(self.on_event_loop_exception) |
|
|
|
#self.asyncio_loop.set_debug(1) |
|
|
|
self._run_forever = asyncio.Future() |
|
|
|
self._thread = threading.Thread(target=self.asyncio_loop.run_until_complete, |
|
|
@ -237,6 +238,15 @@ class Network(PrintError): |
|
|
|
def get_instance(): |
|
|
|
return INSTANCE |
|
|
|
|
|
|
|
def on_event_loop_exception(self, loop, context): |
|
|
|
"""Suppress spurious messages it appears we cannot control.""" |
|
|
|
SUPPRESS_MESSAGE_REGEX = re.compile('SSL handshake|Fatal read error on|' |
|
|
|
'SSL error in data received') |
|
|
|
message = context.get('message') |
|
|
|
if message and SUPPRESS_MESSAGE_REGEX.match(message): |
|
|
|
return |
|
|
|
loop.default_exception_handler(context) |
|
|
|
|
|
|
|
def with_recent_servers_lock(func): |
|
|
|
def func_wrapper(self, *args, **kwargs): |
|
|
|
with self.recent_servers_lock: |
|
|
|