Fix a future .callback usage in rlpx (#666)

This commit is contained in:
Kim De Mey 2024-01-19 12:29:11 +01:00 committed by GitHub
parent c57cebfd81
commit 2c6049b126
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -1175,12 +1175,14 @@ proc postHelloSteps(peer: Peer, h: DevP2P.hello) {.async.} =
#
var messageProcessingLoop = peer.dispatchMessages()
messageProcessingLoop.callback = proc(p: pointer) {.gcsafe.} =
let cb = proc(p: pointer) {.gcsafe.} =
if messageProcessingLoop.failed:
debug "Ending dispatchMessages loop", peer,
err = messageProcessingLoop.error.msg
traceAsyncErrors peer.disconnect(ClientQuitting)
messageProcessingLoop.addCallback(cb)
# The handshake may involve multiple async steps, so we wait
# here for all of them to finish.
#