net: Have LookupNumeric return a CService directly

This commit is contained in:
Cory Fields
2016-08-04 16:37:49 -04:00
committed by lateminer
parent 327528fbf1
commit 84a208b9d2
8 changed files with 18 additions and 21 deletions

View File

@@ -1723,8 +1723,7 @@ std::vector<AddedNodeInfo> GetAddedNodeInfo()
}
BOOST_FOREACH(const std::string& strAddNode, lAddresses) {
CService service;
LookupNumeric(strAddNode.c_str(), service, Params().GetDefaultPort());
CService service(LookupNumeric(strAddNode.c_str(), Params().GetDefaultPort()));
if (service.IsValid()) {
// strAddNode is an IP:port
auto it = mapConnected.find(service);
@@ -1762,8 +1761,7 @@ void ThreadOpenAddedConnections()
CSemaphoreGrant grant(*semOutbound);
// If strAddedNode is an IP/port, decode it immediately, so
// OpenNetworkConnection can detect existing connections to that IP/port.
CService service;
LookupNumeric(info.strAddedNode.c_str(), service, Params().GetDefaultPort());
CService service(LookupNumeric(info.strAddedNode.c_str(), Params().GetDefaultPort()));
OpenNetworkConnection(CAddress(service, NODE_NONE), false, &grant, info.strAddedNode.c_str(), false);
MilliSleep(500);
}