Add ThreadGetMyExternalIP to net thread group

Fixes #3372 -- crash at shutdown.
This commit is contained in:
Gavin Andresen 2013-12-09 14:08:51 +10:00
parent 70370ae502
commit 80ecf6702a

View file

@ -1690,7 +1690,7 @@ bool BindListenPort(const CService &addrBind, string& strError)
return true; return true;
} }
void static Discover() void static Discover(boost::thread_group& threadGroup)
{ {
if (!fDiscover) if (!fDiscover)
return; return;
@ -1743,7 +1743,7 @@ void static Discover()
// Don't use external IPv4 discovery, when -onlynet="IPv6" // Don't use external IPv4 discovery, when -onlynet="IPv6"
if (!IsLimited(NET_IPV4)) if (!IsLimited(NET_IPV4))
boost::thread(boost::bind(&TraceThread<void (*)()>, "ext-ip", &ThreadGetMyExternalIP)); threadGroup.create_thread(boost::bind(&TraceThread<void (*)()>, "ext-ip", &ThreadGetMyExternalIP));
} }
void StartNode(boost::thread_group& threadGroup) void StartNode(boost::thread_group& threadGroup)
@ -1757,7 +1757,7 @@ void StartNode(boost::thread_group& threadGroup)
if (pnodeLocalHost == NULL) if (pnodeLocalHost == NULL)
pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress(CService("127.0.0.1", 0), nLocalServices)); pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress(CService("127.0.0.1", 0), nLocalServices));
Discover(); Discover(threadGroup);
// //
// Start threads // Start threads