diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2016-08-04 16:37:49 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2016-08-04 16:41:39 -0400 |
commit | 8945384bca00f74ba85c98a52925c254c49025a5 (patch) | |
tree | c5479d77e5feb28ed75b53715073bcf3b46c1ffe /src/torcontrol.cpp | |
parent | 21ba407a7369a0229b8a8554dee0da63a64e6639 (diff) |
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
Diffstat (limited to 'src/torcontrol.cpp')
-rw-r--r-- | src/torcontrol.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index c7f9627005..99c45d489c 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -438,7 +438,7 @@ void TorController::add_onion_cb(TorControlConnection& conn, const TorControlRep if ((i = m.find("PrivateKey")) != m.end()) private_key = i->second; } - LookupNumeric(std::string(service_id+".onion").c_str(), service, GetListenPort()); + service = LookupNumeric(std::string(service_id+".onion").c_str(), GetListenPort()); LogPrintf("tor: Got service ID %s, advertising service %s\n", service_id, service.ToString()); if (WriteBinaryFile(GetPrivateKeyFile(), private_key)) { LogPrint("tor", "tor: Cached service private key to %s\n", GetPrivateKeyFile()); @@ -462,8 +462,7 @@ void TorController::auth_cb(TorControlConnection& conn, const TorControlReply& r // Now that we know Tor is running setup the proxy for onion addresses // if -onion isn't set to something else. if (GetArg("-onion", "") == "") { - CService resolved; - assert(LookupNumeric("127.0.0.1", resolved, 9050)); + CService resolved(LookupNumeric("127.0.0.1", 9050)); proxyType addrOnion = proxyType(resolved, true); SetProxy(NET_TOR, addrOnion); SetLimited(NET_TOR, false); |