mirror of https://github.com/status-im/nim-eth.git
Add check if message loop is finished during connection stage
This commit is contained in:
parent
d535bb1ade
commit
0a5d6118c2
|
@ -1291,6 +1291,13 @@ proc postHelloSteps(peer: Peer, h: devp2p.hello) {.async.} =
|
||||||
#
|
#
|
||||||
await all(subProtocolsHandshakes)
|
await all(subProtocolsHandshakes)
|
||||||
|
|
||||||
|
# This is needed as a peer might have already disconnected. In this case
|
||||||
|
# we need to raise so that rlpxConnect/rlpxAccept fails.
|
||||||
|
# Disconnect is done only to run the disconnect handlers. TODO: improve this
|
||||||
|
# also TODO: Should we discern the type of error?
|
||||||
|
if messageProcessingLoop.finished:
|
||||||
|
await peer.disconnectAndRaise(ClientQuitting,
|
||||||
|
"messageProcessingLoop ended while connecting")
|
||||||
peer.connectionState = Connected
|
peer.connectionState = Connected
|
||||||
|
|
||||||
template `^`(arr): auto =
|
template `^`(arr): auto =
|
||||||
|
|
Loading…
Reference in New Issue