Skip to content

Commit 2cdab2a

Browse files
committed
Node: crash fix (fix of fix)
1 parent d9d1205 commit 2cdab2a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

node/node.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,15 +1183,16 @@ void Node::Peer::OnMsg(proto::Authentication&& msg)
11831183
// Duplicate connection. In this case we have to choose wether to terminate this connection, or the previous. The best is to do it asymmetrically.
11841184
// We decide this based on our Node IDs.
11851185
// In addition, if the older connection isn't completed yet (i.e. it's our connect attempt) - it's prefered for deletion, because such a connection may be impossible (firewalls and friends).
1186+
Peer* pDup = pPi->m_pLive;
11861187

1187-
if (!pPi->m_pLive->IsSecureOut() || (m_This.m_MyPublicID > msg.m_ID))
1188+
if (!pDup->IsSecureOut() || (m_This.m_MyPublicID > msg.m_ID))
11881189
{
11891190
// detach from that peer
1190-
assert(pPi == pPi->m_pLive->m_pInfo);
1191-
pPi->m_pLive->m_pInfo = nullptr;
1191+
assert(pPi == pDup->m_pInfo);
1192+
pDup->m_pInfo = nullptr;
11921193
pPi->m_pLive = nullptr;
11931194

1194-
pPi->m_pLive->DeleteSelf(false, ByeReason::Duplicate);
1195+
pDup->DeleteSelf(false, ByeReason::Duplicate);
11951196
assert(!pPi->m_pLive);
11961197
}
11971198
else

0 commit comments

Comments
 (0)