Skip to content

Commit 4479c0a

Browse files
authored
fix some libp2p channel hangs (#2032)
* fix some libp2p channel hangs * make sure no concurrent reads are issues by awaiting cancellations * bumps with fixes * merge bump
1 parent 9e716b3 commit 4479c0a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

beacon_chain/eth2_network.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,15 @@ proc sendErrorResponse(peer: Peer,
499499
peer, responseCode, errMsg = formatErrorMsg(errMsg)
500500
conn.writeChunk(some responseCode, SSZ.encode(errMsg))
501501

502-
proc sendNotificationMsg(peer: Peer, protocolId: string, requestBytes: Bytes) {.async} =
502+
proc sendNotificationMsg(peer: Peer, protocolId: string, requestBytes: Bytes) {.async.} =
503503
var
504504
deadline = sleepAsync RESP_TIMEOUT
505505
streamFut = peer.network.openStream(peer, protocolId)
506506

507507
await streamFut or deadline
508508

509509
if not streamFut.finished:
510-
streamFut.cancel()
510+
await streamFut.cancelAndWait()
511511
raise newException(TransmissionError, "Failed to open LibP2P stream")
512512

513513
let stream = streamFut.read

vendor/nim-eth

vendor/nim-libp2p

0 commit comments

Comments
 (0)