handle CancelledError

This commit is contained in:
Diego 2024-03-20 11:04:50 +01:00
parent a65ce6a47a
commit 1342b45b29
No known key found for this signature in database
GPG Key ID: C9DAC9BF68D1F806

View File

@ -299,7 +299,10 @@ proc sendMsgSlow(p: PubSubPeer, msg: seq[byte]) {.async.} =
return
trace "sending encoded msg to peer", conn, encoded = shortLog(msg), p
await sendMsgContinue(conn, conn.writeLp(msg))
try:
await sendMsgContinue(conn, conn.writeLp(msg))
except CancelledError as exc:
trace "Continuation for pending `sendMsg` future has been unexpectedly cancelled"
proc sendMsg(p: PubSubPeer, msg: seq[byte]): Future[void] =
if p.sendConn != nil and not p.sendConn.closed():