Skip to content

Commit 5737bd2

Browse files
committed
Fix crash: null socket check in Connection::write()
During header sync, peers disconnect (EOF) asynchronously. If a chain tip changed handler fires request_full_block() after the peer disconnected but before the connection was removed, writing to the null m_socket caused SIGSEGV (signal 11). Add null guard in Connection::write() — skip if socket is gone.
1 parent f002c48 commit 5737bd2

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/impl/ltc/coin/p2p_connection.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class Connection
6464

6565
void write(std::unique_ptr<RawMessage>& rmsg)
6666
{
67+
if (!m_socket) return; // peer disconnected
6768
m_socket->write(std::move(rmsg));
6869
}
6970

0 commit comments

Comments
 (0)