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

@@ -1109,8 +1109,7 @@ bool AppInit2(Config& config, boost::thread_group& threadGroup, CScheduler& sche
std::string proxyArg = GetArg("-proxy", "");
SetLimited(NET_TOR);
if (proxyArg != "" && proxyArg != "0") {
CService resolved;
LookupNumeric(proxyArg.c_str(), resolved, 9050);
CService resolved(LookupNumeric(proxyArg.c_str(), 9050));
proxyType addrProxy = proxyType(resolved, proxyRandomize);
if (!addrProxy.IsValid())
return InitError(strprintf(_("Invalid -proxy address: '%s'"), proxyArg));
@@ -1130,8 +1129,7 @@ bool AppInit2(Config& config, boost::thread_group& threadGroup, CScheduler& sche
if (onionArg == "0") { // Handle -noonion/-onion=0
SetLimited(NET_TOR); // set onions as unreachable
} else {
CService resolved;
LookupNumeric(onionArg.c_str(), resolved, 9050);
CService resolved(LookupNumeric(onionArg.c_str(), 9050));
proxyType addrOnion = proxyType(resolved, proxyRandomize);
if (!addrOnion.IsValid())
return InitError(strprintf(_("Invalid -onion address: '%s'"), onionArg));