net: Drop StartNode/StopNode and use CConnman directly

This commit is contained in:
Cory Fields
2016-05-26 23:29:39 -04:00
parent e81a602cf0
commit bafa5fc5a1
3 changed files with 11 additions and 26 deletions

View File

@@ -199,7 +199,8 @@ void Shutdown()
if (pwalletMain)
pwalletMain->Flush(false);
#endif
StopNode(*g_connman);
MapPort(false);
g_connman->Stop();
g_connman.reset();
StopTorControl();
@@ -1508,9 +1509,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (GetBoolArg("-listenonion", DEFAULT_LISTEN_ONION))
StartTorControl(threadGroup, scheduler);
Discover(threadGroup);
// Map ports with UPnP
MapPort(GetBoolArg("-upnp", DEFAULT_UPNP));
std::string strNodeError;
int nMaxOutbound = std::min(MAX_OUTBOUND_CONNECTIONS, nMaxConnections);
if(!StartNode(connman, threadGroup, scheduler, nLocalServices, nRelevantServices, nMaxConnections, nMaxOutbound, chainActive.Height(), &uiInterface, strNodeError))
if(!connman.Start(threadGroup, scheduler, nLocalServices, nRelevantServices, nMaxConnections, nMaxOutbound, chainActive.Height(), &uiInterface, strNodeError))
return InitError(strNodeError);
// ********************************************************* Step 12: finished