forked from LBRYCommunity/lbry-sdk
fixes stalling client reconnect issue
This commit is contained in:
parent
f6d0847453
commit
9815ddef1f
1 changed files with 7 additions and 4 deletions
|
@ -296,10 +296,13 @@ class Network:
|
||||||
log.info("maintaining connection to spv server %s", server_str)
|
log.info("maintaining connection to spv server %s", server_str)
|
||||||
self._keepalive_task = asyncio.create_task(self.client.keepalive_loop())
|
self._keepalive_task = asyncio.create_task(self.client.keepalive_loop())
|
||||||
try:
|
try:
|
||||||
await asyncio.wait(
|
if not self._urgent_need_reconnect.is_set():
|
||||||
[self._keepalive_task, self._urgent_need_reconnect.wait()],
|
await asyncio.wait(
|
||||||
return_when=asyncio.FIRST_COMPLETED
|
[self._keepalive_task, self._urgent_need_reconnect.wait()],
|
||||||
)
|
return_when=asyncio.FIRST_COMPLETED
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
await self._keepalive_task
|
||||||
if self._urgent_need_reconnect.is_set():
|
if self._urgent_need_reconnect.is_set():
|
||||||
log.warning("urgent reconnect needed")
|
log.warning("urgent reconnect needed")
|
||||||
self._urgent_need_reconnect.clear()
|
self._urgent_need_reconnect.clear()
|
||||||
|
|
Loading…
Reference in a new issue