mirror of
https://github.com/status-im/nim-libp2p.git
synced 2025-02-16 14:58:11 +00:00
handle CancelledError
This commit is contained in:
parent
a65ce6a47a
commit
1342b45b29
@ -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():
|
||||
|
Loading…
x
Reference in New Issue
Block a user