fix SSL log spam on py3.7
based on kyuupichan/electrumx@83813ff1ac see pooler/electrum-ltc#191
This commit is contained in:
@@ -221,6 +221,7 @@ class Network(PrintError):
|
|||||||
self.proxy = None
|
self.proxy = None
|
||||||
|
|
||||||
self.asyncio_loop = asyncio.get_event_loop()
|
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.asyncio_loop.set_debug(1)
|
||||||
self._run_forever = asyncio.Future()
|
self._run_forever = asyncio.Future()
|
||||||
self._thread = threading.Thread(target=self.asyncio_loop.run_until_complete,
|
self._thread = threading.Thread(target=self.asyncio_loop.run_until_complete,
|
||||||
@@ -237,6 +238,15 @@ class Network(PrintError):
|
|||||||
def get_instance():
|
def get_instance():
|
||||||
return 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 with_recent_servers_lock(func):
|
||||||
def func_wrapper(self, *args, **kwargs):
|
def func_wrapper(self, *args, **kwargs):
|
||||||
with self.recent_servers_lock:
|
with self.recent_servers_lock:
|
||||||
|
|||||||
Reference in New Issue
Block a user