aboutsummaryrefslogtreecommitdiff
path: root/src/torcontrol.cpp
diff options
context:
space:
mode:
authorbrunoerg <brunoely.gc@gmail.com>2022-10-10 15:02:59 -0300
committerbrunoerg <brunoely.gc@gmail.com>2023-05-26 13:40:02 -0300
commit34bcdfc6a65de906c65edccdd96fe15219081cd2 (patch)
tree389c24b5899b46f1d676974b88b2dbaec44638c3 /src/torcontrol.cpp
parent7799eb125b7a1146f8251be5d26df574236212a9 (diff)
p2p, refactor: return vector/optional<CService> in `Lookup`
Diffstat (limited to 'src/torcontrol.cpp')
-rw-r--r--src/torcontrol.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp
index 92b55f9fc4..98d68f93e9 100644
--- a/src/torcontrol.cpp
+++ b/src/torcontrol.cpp
@@ -133,15 +133,15 @@ bool TorControlConnection::Connect(const std::string& tor_control_center, const
Disconnect();
}
- CService control_service;
- if (!Lookup(tor_control_center, control_service, 9051, fNameLookup)) {
+ const std::optional<CService> control_service{Lookup(tor_control_center, 9051, fNameLookup)};
+ if (!control_service.has_value()) {
LogPrintf("tor: Failed to look up control center %s\n", tor_control_center);
return false;
}
struct sockaddr_storage control_address;
socklen_t control_address_len = sizeof(control_address);
- if (!control_service.GetSockAddr(reinterpret_cast<struct sockaddr*>(&control_address), &control_address_len)) {
+ if (!control_service.value().GetSockAddr(reinterpret_cast<struct sockaddr*>(&control_address), &control_address_len)) {
LogPrintf("tor: Error parsing socket address %s\n", tor_control_center);
return false;
}