Skip to content

Commit 28f11e9

Browse files
committed
net: pass CConnman via pointer rather than reference
There are a few too many edge-cases here to make this a scripted diff. The following commits will move a few functions into PeerLogicValidation, where the local connman instance can be used. This change prepares for that usage.
1 parent bcc8a62 commit 28f11e9

File tree

5 files changed

+104
-104
lines changed

5 files changed

+104
-104
lines changed

src/net.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
11141114
CNode* pnode = new CNode(id, nLocalServices, GetBestHeight(), hSocket, addr, CalculateKeyedNetGroup(addr), nonce, addr_bind, "", true);
11151115
pnode->AddRef();
11161116
pnode->fWhitelisted = whitelisted;
1117-
GetNodeSignals().InitializeNode(pnode, *this);
1117+
GetNodeSignals().InitializeNode(pnode, this);
11181118

11191119
LogPrint(BCLog::NET, "connection from %s accepted\n", addr.ToString());
11201120

@@ -1966,7 +1966,7 @@ bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
19661966
if (fAddnode)
19671967
pnode->fAddnode = true;
19681968

1969-
GetNodeSignals().InitializeNode(pnode, *this);
1969+
GetNodeSignals().InitializeNode(pnode, this);
19701970
{
19711971
LOCK(cs_vNodes);
19721972
vNodes.push_back(pnode);
@@ -1996,15 +1996,15 @@ void CConnman::ThreadMessageHandler()
19961996
continue;
19971997

19981998
// Receive messages
1999-
bool fMoreNodeWork = GetNodeSignals().ProcessMessages(pnode, *this, flagInterruptMsgProc);
1999+
bool fMoreNodeWork = GetNodeSignals().ProcessMessages(pnode, this, flagInterruptMsgProc);
20002000
fMoreWork |= (fMoreNodeWork && !pnode->fPauseSend);
20012001
if (flagInterruptMsgProc)
20022002
return;
20032003

20042004
// Send messages
20052005
{
20062006
LOCK(pnode->cs_sendProcessing);
2007-
GetNodeSignals().SendMessages(pnode, *this, flagInterruptMsgProc);
2007+
GetNodeSignals().SendMessages(pnode, this, flagInterruptMsgProc);
20082008
}
20092009
if (flagInterruptMsgProc)
20102010
return;

src/net.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,9 @@ struct CombinerAll
441441
// Signals for message handling
442442
struct CNodeSignals
443443
{
444-
boost::signals2::signal<bool (CNode*, CConnman&, std::atomic<bool>&), CombinerAll> ProcessMessages;
445-
boost::signals2::signal<bool (CNode*, CConnman&, std::atomic<bool>&), CombinerAll> SendMessages;
446-
boost::signals2::signal<void (CNode*, CConnman&)> InitializeNode;
444+
boost::signals2::signal<bool (CNode*, CConnman*, std::atomic<bool>&), CombinerAll> ProcessMessages;
445+
boost::signals2::signal<bool (CNode*, CConnman*, std::atomic<bool>&), CombinerAll> SendMessages;
446+
boost::signals2::signal<void (CNode*, CConnman*)> InitializeNode;
447447
boost::signals2::signal<void (NodeId, bool&)> FinalizeNode;
448448
};
449449

0 commit comments

Comments
 (0)