Commit 16d5a95
committed
fix: crash on double peer_destroy (ASSERT paddr->connected == 1)
On Linux, peer_destroy was crashing with 'ASSERT(peer->paddr->connected
== 1) not TRUE' when a peer's verack handler returned an error (e.g.
peergroup_handle_handshake_ok returned nonzero), causing peer_receive_cb
to goto exit -> peer_destroy. But the network layer may have already
torn down the same peer (socket closed while the message handler was
running), setting paddr->connected = 0 in a prior peer_destroy call --
making this a legitimate double-destroy race, not a programmer error.
Replaced the ASSERT with a graceful early-return guard: if
paddr->connected is already 0, the peer has already been cleaned up;
log and return instead of crashing.1 parent eb677e6 commit 16d5a95
1 file changed
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
487 | 500 | | |
488 | 501 | | |
489 | 502 | | |
490 | | - | |
491 | 503 | | |
492 | 504 | | |
493 | 505 | | |
| |||
0 commit comments