mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Merge bitcoin/bitcoin#25619: net: avoid overriding non-virtual ToString() in CService and use better naming
c9d548c91fnet: remove CService::ToStringPort() (Vasil Dimov)fd4f0f41e9gui: simplify OptionsDialog::updateDefaultProxyNets() (Vasil Dimov)96c791dd20net: remove CService::ToString() use ToStringAddrPort() instead (Vasil Dimov)944a9de08anet: remove CNetAddr::ToString() and use ToStringAddr() instead (Vasil Dimov)043b9de59ascripted-diff: rename ToStringIP[Port]() to ToStringAddr[Port]() (Vasil Dimov) Pull request description: Before this PR we had the somewhat confusing combination of methods: `CNetAddr::ToStringIP()` `CNetAddr::ToString()` (duplicate of the above) `CService::ToStringIPPort()` `CService::ToString()` (duplicate of the above, overrides a non-virtual method from `CNetAddr`) `CService::ToStringPort()` Avoid [overriding non-virtual methods](https://github.com/bitcoin/bitcoin/pull/25349/#issuecomment-1185226396). "IP" stands for "Internet Protocol" and while sometimes "IP addresses" are called just "IPs", it is incorrect to call Tor or I2P addresses "IPs". Thus use "Addr" instead of "IP". Change the above to: `CNetAddr::ToStringAddr()` `CService::ToStringAddrPort()` The changes touch a lot of files, but are mostly mechanical. ACKs for top commit: sipa: utACKc9d548c91fachow101: ACKc9d548c91fjonatack: re-ACKc9d548c91fonly change since my previous reviews is rebase, but as a sanity check rebased to current master and at each commit quickly re-reviewed and re-verified clean build and green unit tests LarryRuane: ACKc9d548c91fTree-SHA512: 633fb044bdecf9f551b5e3314c385bf10e2b78e8027dc51ec324b66b018da35e5b01f3fbe6295bbc455ea1bcd1a3629de1918d28de510693afaf6a52693f2157
This commit is contained in:
10
src/i2p.cpp
10
src/i2p.cpp
@@ -206,7 +206,7 @@ bool Session::Connect(const CService& to, Connection& conn, bool& proxy_error)
|
||||
}
|
||||
|
||||
const Reply& lookup_reply =
|
||||
SendRequestAndGetReply(*sock, strprintf("NAMING LOOKUP NAME=%s", to.ToStringIP()));
|
||||
SendRequestAndGetReply(*sock, strprintf("NAMING LOOKUP NAME=%s", to.ToStringAddr()));
|
||||
|
||||
const std::string& dest = lookup_reply.Get("VALUE");
|
||||
|
||||
@@ -233,7 +233,7 @@ bool Session::Connect(const CService& to, Connection& conn, bool& proxy_error)
|
||||
|
||||
throw std::runtime_error(strprintf("\"%s\"", connect_reply.full));
|
||||
} catch (const std::runtime_error& e) {
|
||||
Log("Error connecting to %s: %s", to.ToString(), e.what());
|
||||
Log("Error connecting to %s: %s", to.ToStringAddrPort(), e.what());
|
||||
CheckControlSock();
|
||||
return false;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ std::unique_ptr<Sock> Session::Hello() const
|
||||
}
|
||||
|
||||
if (!ConnectSocketDirectly(m_control_host, *sock, nConnectTimeout, true)) {
|
||||
throw std::runtime_error(strprintf("Cannot connect to %s", m_control_host.ToString()));
|
||||
throw std::runtime_error(strprintf("Cannot connect to %s", m_control_host.ToStringAddrPort()));
|
||||
}
|
||||
|
||||
SendRequestAndGetReply(*sock, "HELLO VERSION MIN=3.1 MAX=3.1");
|
||||
@@ -371,7 +371,7 @@ void Session::CreateIfNotCreatedAlready()
|
||||
const auto session_type = m_transient ? "transient" : "persistent";
|
||||
const auto session_id = GetRandHash().GetHex().substr(0, 10); // full is overkill, too verbose in the logs
|
||||
|
||||
Log("Creating %s SAM session %s with %s", session_type, session_id, m_control_host.ToString());
|
||||
Log("Creating %s SAM session %s with %s", session_type, session_id, m_control_host.ToStringAddrPort());
|
||||
|
||||
auto sock = Hello();
|
||||
|
||||
@@ -408,7 +408,7 @@ void Session::CreateIfNotCreatedAlready()
|
||||
Log("%s SAM session %s created, my address=%s",
|
||||
Capitalize(session_type),
|
||||
m_session_id,
|
||||
m_my_addr.ToString());
|
||||
m_my_addr.ToStringAddrPort());
|
||||
}
|
||||
|
||||
std::unique_ptr<Sock> Session::StreamAccept()
|
||||
|
||||
Reference in New Issue
Block a user