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
This commit is contained in:
parent
9e716b32bd
commit
4479c0a9f1
|
@ -499,7 +499,7 @@ proc sendErrorResponse(peer: Peer,
|
||||||
peer, responseCode, errMsg = formatErrorMsg(errMsg)
|
peer, responseCode, errMsg = formatErrorMsg(errMsg)
|
||||||
conn.writeChunk(some responseCode, SSZ.encode(errMsg))
|
conn.writeChunk(some responseCode, SSZ.encode(errMsg))
|
||||||
|
|
||||||
proc sendNotificationMsg(peer: Peer, protocolId: string, requestBytes: Bytes) {.async} =
|
proc sendNotificationMsg(peer: Peer, protocolId: string, requestBytes: Bytes) {.async.} =
|
||||||
var
|
var
|
||||||
deadline = sleepAsync RESP_TIMEOUT
|
deadline = sleepAsync RESP_TIMEOUT
|
||||||
streamFut = peer.network.openStream(peer, protocolId)
|
streamFut = peer.network.openStream(peer, protocolId)
|
||||||
|
@ -507,7 +507,7 @@ proc sendNotificationMsg(peer: Peer, protocolId: string, requestBytes: Bytes) {.
|
||||||
await streamFut or deadline
|
await streamFut or deadline
|
||||||
|
|
||||||
if not streamFut.finished:
|
if not streamFut.finished:
|
||||||
streamFut.cancel()
|
await streamFut.cancelAndWait()
|
||||||
raise newException(TransmissionError, "Failed to open LibP2P stream")
|
raise newException(TransmissionError, "Failed to open LibP2P stream")
|
||||||
|
|
||||||
let stream = streamFut.read
|
let stream = streamFut.read
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit bc8a8947fc146cfb0765f407528669932e604d8a
|
Subproject commit 114680453f789f947a3c057bbeb5bdf593f5364b
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3956f3fd6930ee46047e7fc3dd370b203c4c4ff8
|
Subproject commit 74acd0a33ac6e77463094034a2433a379e3b9add
|
Loading…
Reference in New Issue