Browse Source
network: set _loop_thread again as it helps debugging
related: #6825
patch-4
SomberNight
4 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
6 additions and
1 deletions
-
electrum/network.py
-
electrum/util.py
|
@ -266,7 +266,11 @@ class Network(Logger, NetworkRetryManager[ServerAddr]): |
|
|
|
|
|
|
|
|
self.asyncio_loop = asyncio.get_event_loop() |
|
|
self.asyncio_loop = asyncio.get_event_loop() |
|
|
assert self.asyncio_loop.is_running(), "event loop not running" |
|
|
assert self.asyncio_loop.is_running(), "event loop not running" |
|
|
self._loop_thread = None # type: threading.Thread # set by caller; only used for sanity checks |
|
|
try: |
|
|
|
|
|
self._loop_thread = self.asyncio_loop._mythread # type: threading.Thread # only used for sanity checks |
|
|
|
|
|
except AttributeError as e: |
|
|
|
|
|
self.logger.warning(f"asyncio loop does not have _mythread set: {e!r}") |
|
|
|
|
|
self._loop_thread = None |
|
|
|
|
|
|
|
|
assert isinstance(config, SimpleConfig), f"config should be a SimpleConfig instead of {type(config)}" |
|
|
assert isinstance(config, SimpleConfig), f"config should be a SimpleConfig instead of {type(config)}" |
|
|
self.config = config |
|
|
self.config = config |
|
|
|
@ -1187,6 +1187,7 @@ def create_and_start_event_loop() -> Tuple[asyncio.AbstractEventLoop, |
|
|
args=(stopping_fut,), |
|
|
args=(stopping_fut,), |
|
|
name='EventLoop') |
|
|
name='EventLoop') |
|
|
loop_thread.start() |
|
|
loop_thread.start() |
|
|
|
|
|
loop._mythread = loop_thread |
|
|
return loop, stopping_fut, loop_thread |
|
|
return loop, stopping_fut, loop_thread |
|
|
|
|
|
|
|
|
|
|
|
|
|
|