Skip to content

Commit 7325b15

Browse files
committed
net: a few small cleanups before replacing boost threads
- Drop the interruption point directly after the pnode allocation. This would be leaky if hit. - Rearrange thread creation so that the socket handler comes first
1 parent 2a524b8 commit 7325b15

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/net.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,6 @@ bool CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
18061806
return false;
18071807

18081808
CNode* pnode = ConnectNode(addrConnect, pszDest, fCountFailure);
1809-
boost::this_thread::interruption_point();
18101809

18111810
if (!pnode)
18121811
return false;
@@ -2146,14 +2145,14 @@ bool CConnman::Start(boost::thread_group& threadGroup, CScheduler& scheduler, st
21462145
// Start threads
21472146
//
21482147

2148+
// Send and receive from sockets, accept connections
2149+
threadGroup.create_thread(boost::bind(&TraceThread<boost::function<void()> >, "net", boost::function<void()>(boost::bind(&CConnman::ThreadSocketHandler, this))));
2150+
21492151
if (!GetBoolArg("-dnsseed", true))
21502152
LogPrintf("DNS seeding disabled\n");
21512153
else
21522154
threadGroup.create_thread(boost::bind(&TraceThread<boost::function<void()> >, "dnsseed", boost::function<void()>(boost::bind(&CConnman::ThreadDNSAddressSeed, this))));
21532155

2154-
// Send and receive from sockets, accept connections
2155-
threadGroup.create_thread(boost::bind(&TraceThread<boost::function<void()> >, "net", boost::function<void()>(boost::bind(&CConnman::ThreadSocketHandler, this))));
2156-
21572156
// Initiate outbound connections from -addnode
21582157
threadGroup.create_thread(boost::bind(&TraceThread<boost::function<void()> >, "addcon", boost::function<void()>(boost::bind(&CConnman::ThreadOpenAddedConnections, this))));
21592158

0 commit comments

Comments
 (0)