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:
Jacek Sieka 2020-11-17 16:07:05 +01:00 committed by GitHub
parent 9e716b32bd
commit 4479c0a9f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -499,7 +499,7 @@ proc sendErrorResponse(peer: Peer,
peer, responseCode, errMsg = formatErrorMsg(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
deadline = sleepAsync RESP_TIMEOUT
streamFut = peer.network.openStream(peer, protocolId)
@ -507,7 +507,7 @@ proc sendNotificationMsg(peer: Peer, protocolId: string, requestBytes: Bytes) {.
await streamFut or deadline
if not streamFut.finished:
streamFut.cancel()
await streamFut.cancelAndWait()
raise newException(TransmissionError, "Failed to open LibP2P stream")
let stream = streamFut.read

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit bc8a8947fc146cfb0765f407528669932e604d8a
Subproject commit 114680453f789f947a3c057bbeb5bdf593f5364b

2
vendor/nim-libp2p vendored

@ -1 +1 @@
Subproject commit 3956f3fd6930ee46047e7fc3dd370b203c4c4ff8
Subproject commit 74acd0a33ac6e77463094034a2433a379e3b9add