canary exits with error if ping fails (#3711)

This commit is contained in:
Ivan FB 2026-02-11 16:19:58 +01:00 committed by GitHub
parent a8bdbca98a
commit dd8dc7429d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -278,6 +278,10 @@ proc main(rng: ref HmacDrbgContext): Future[int] {.async.} =
pingSuccess = false
error "Ping operation failed or timed out", error = exc.msg
if not pingSuccess:
error "Ping to the node failed", peerId = peer.peerId, conStatus = $conStatus
quit(QuitFailure)
if conStatus in [Connected, CanConnect]:
let nodeProtocols = lp2pPeerStore[ProtoBook][peer.peerId]
@ -285,11 +289,6 @@ proc main(rng: ref HmacDrbgContext): Future[int] {.async.} =
error "Not all protocols are supported",
expected = conf.protocols, supported = nodeProtocols
quit(QuitFailure)
# Check ping result if ping was enabled
if conf.ping and not pingSuccess:
error "Node is reachable and supports protocols but ping failed - connection may be unstable"
quit(QuitFailure)
elif conStatus == CannotConnect:
error "Could not connect", peerId = peer.peerId
quit(QuitFailure)