mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
net: Have LookupNumeric return a CService directly
Also fix up a few small issues: - Lookup with "badip:port" now sets the port to 0 - Don't allow assert to have side-effects
This commit is contained in:
@@ -1728,8 +1728,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);
|
||||
@@ -1767,8 +1766,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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user