lnpeer: move ping_if_required away from message_loop
If our connection dies because we went to sleep, message_loop will stall and ping_if_required will never be called.
This commit is contained in:
@@ -463,7 +463,6 @@ class Peer(Logger):
|
|||||||
async for msg in self.transport.read_messages():
|
async for msg in self.transport.read_messages():
|
||||||
self.process_message(msg)
|
self.process_message(msg)
|
||||||
await asyncio.sleep(.01)
|
await asyncio.sleep(.01)
|
||||||
self.ping_if_required()
|
|
||||||
|
|
||||||
def on_reply_short_channel_ids_end(self, payload):
|
def on_reply_short_channel_ids_end(self, payload):
|
||||||
self.querying.set()
|
self.querying.set()
|
||||||
@@ -1452,8 +1451,10 @@ class Peer(Logger):
|
|||||||
return closing_tx.txid()
|
return closing_tx.txid()
|
||||||
|
|
||||||
async def htlc_switch(self):
|
async def htlc_switch(self):
|
||||||
|
await self.initialized
|
||||||
while True:
|
while True:
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
self.ping_if_required()
|
||||||
for chan_id, chan in self.channels.items():
|
for chan_id, chan in self.channels.items():
|
||||||
if not chan.can_send_ctx_updates():
|
if not chan.can_send_ctx_updates():
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user