@@ -278,7 +278,7 @@ class DaemonThread(threading.Thread, PrintError):
|
||||
self.print_error("stopped")
|
||||
|
||||
|
||||
verbosity = '*'
|
||||
verbosity = ''
|
||||
def set_verbosity(filters: Union[str, bool]):
|
||||
global verbosity
|
||||
if type(filters) is bool: # backwards compat
|
||||
@@ -983,3 +983,26 @@ class NetworkJobOnDefaultServer(PrintError):
|
||||
s = self.interface.session
|
||||
assert s is not None
|
||||
return s
|
||||
|
||||
|
||||
def create_and_start_event_loop() -> Tuple[asyncio.AbstractEventLoop,
|
||||
asyncio.Future,
|
||||
threading.Thread]:
|
||||
def on_exception(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)
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.set_exception_handler(on_exception)
|
||||
# loop.set_debug(1)
|
||||
stopping_fut = asyncio.Future()
|
||||
loop_thread = threading.Thread(target=loop.run_until_complete,
|
||||
args=(stopping_fut,),
|
||||
name='EventLoop')
|
||||
loop_thread.start()
|
||||
return loop, stopping_fut, loop_thread
|
||||
|
||||
Reference in New Issue
Block a user