mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
scripted-diff: LogPrintf -> LogInfo
This refactor does not change behavior. -BEGIN VERIFY SCRIPT- sed --in-place 's/\<LogPrintf\>/LogInfo/g' \ $( git grep -l '\<LogPrintf\>' -- ./contrib/ ./src/ ./test/ ':(exclude)src/logging.h' ) -END VERIFY SCRIPT-
This commit is contained in:
56
src/net.cpp
56
src/net.cpp
@@ -287,7 +287,7 @@ bool AddLocal(const CService& addr_, int nScore)
|
||||
if (!g_reachable_nets.Contains(addr))
|
||||
return false;
|
||||
|
||||
LogPrintf("AddLocal(%s,%i)\n", addr.ToStringAddrPort(), nScore);
|
||||
LogInfo("AddLocal(%s,%i)\n", addr.ToStringAddrPort(), nScore);
|
||||
|
||||
{
|
||||
LOCK(g_maplocalhost_mutex);
|
||||
@@ -310,7 +310,7 @@ bool AddLocal(const CNetAddr &addr, int nScore)
|
||||
void RemoveLocal(const CService& addr)
|
||||
{
|
||||
LOCK(g_maplocalhost_mutex);
|
||||
LogPrintf("RemoveLocal(%s)\n", addr.ToStringAddrPort());
|
||||
LogInfo("RemoveLocal(%s)\n", addr.ToStringAddrPort());
|
||||
mapLocalHost.erase(addr);
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect,
|
||||
// It is possible that we already have a connection to the IP/port pszDest resolved to.
|
||||
// In that case, drop the connection that was just created.
|
||||
if (AlreadyConnectedToAddressPort(addrConnect)) {
|
||||
LogPrintf("Not opening a connection to %s, already connected to %s\n", pszDest, addrConnect.ToStringAddrPort());
|
||||
LogInfo("Not opening a connection to %s, already connected to %s\n", pszDest, addrConnect.ToStringAddrPort());
|
||||
return nullptr;
|
||||
}
|
||||
// Add the address to the resolved addresses vector so we can try to connect to it later on
|
||||
@@ -1739,7 +1739,7 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
|
||||
if (!sock) {
|
||||
const int nErr = WSAGetLastError();
|
||||
if (nErr != WSAEWOULDBLOCK) {
|
||||
LogPrintf("socket error accept failed: %s\n", NetworkErrorString(nErr));
|
||||
LogInfo("socket error accept failed: %s\n", NetworkErrorString(nErr));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1785,7 +1785,7 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
|
||||
}
|
||||
|
||||
if (!sock->IsSelectable()) {
|
||||
LogPrintf("connection from %s dropped: non-selectable socket\n", addr.ToStringAddrPort());
|
||||
LogInfo("connection from %s dropped: non-selectable socket\n", addr.ToStringAddrPort());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2258,7 +2258,7 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
if (!gArgs.GetArgs("-seednode").empty()) {
|
||||
auto start = NodeClock::now();
|
||||
constexpr std::chrono::seconds SEEDNODE_TIMEOUT = 30s;
|
||||
LogPrintf("-seednode enabled. Trying the provided seeds for %d seconds before defaulting to the dnsseeds.\n", SEEDNODE_TIMEOUT.count());
|
||||
LogInfo("-seednode enabled. Trying the provided seeds for %d seconds before defaulting to the dnsseeds.\n", SEEDNODE_TIMEOUT.count());
|
||||
while (!m_interrupt_net->interrupted()) {
|
||||
if (!m_interrupt_net->sleep_for(500ms)) {
|
||||
return;
|
||||
@@ -2267,13 +2267,13 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
// Abort if we have spent enough time without reaching our target.
|
||||
// Giving seed nodes 30 seconds so this does not become a race against fixedseeds (which triggers after 1 min)
|
||||
if (NodeClock::now() > start + SEEDNODE_TIMEOUT) {
|
||||
LogPrintf("Couldn't connect to enough peers via seed nodes. Handing fetch logic to the DNS seeds.\n");
|
||||
LogInfo("Couldn't connect to enough peers via seed nodes. Handing fetch logic to the DNS seeds.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
outbound_connection_count = GetFullOutboundConnCount();
|
||||
if (outbound_connection_count >= SEED_OUTBOUND_CONNECTION_THRESHOLD) {
|
||||
LogPrintf("P2P peers available. Finished fetching data from seed nodes.\n");
|
||||
LogInfo("P2P peers available. Finished fetching data from seed nodes.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2316,7 +2316,7 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
seeds_right_now += DNSSEEDS_TO_QUERY_AT_ONCE;
|
||||
|
||||
if (addrman.Size() > 0) {
|
||||
LogPrintf("Waiting %d seconds before querying DNS seeds.\n", seeds_wait_time.count());
|
||||
LogInfo("Waiting %d seconds before querying DNS seeds.\n", seeds_wait_time.count());
|
||||
std::chrono::seconds to_wait = seeds_wait_time;
|
||||
while (to_wait.count() > 0) {
|
||||
// if sleeping for the MANY_PEERS interval, wake up
|
||||
@@ -2328,10 +2328,10 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
|
||||
if (GetFullOutboundConnCount() >= SEED_OUTBOUND_CONNECTION_THRESHOLD) {
|
||||
if (found > 0) {
|
||||
LogPrintf("%d addresses found from DNS seeds\n", found);
|
||||
LogPrintf("P2P peers available. Finished DNS seeding.\n");
|
||||
LogInfo("%d addresses found from DNS seeds\n", found);
|
||||
LogInfo("P2P peers available. Finished DNS seeding.\n");
|
||||
} else {
|
||||
LogPrintf("P2P peers available. Skipped DNS seeding.\n");
|
||||
LogInfo("P2P peers available. Skipped DNS seeding.\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2343,13 +2343,13 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
|
||||
// hold off on querying seeds if P2P network deactivated
|
||||
if (!fNetworkActive) {
|
||||
LogPrintf("Waiting for network to be reactivated before querying DNS seeds.\n");
|
||||
LogInfo("Waiting for network to be reactivated before querying DNS seeds.\n");
|
||||
do {
|
||||
if (!m_interrupt_net->sleep_for(1s)) return;
|
||||
} while (!fNetworkActive);
|
||||
}
|
||||
|
||||
LogPrintf("Loading addresses from DNS seed %s\n", seed);
|
||||
LogInfo("Loading addresses from DNS seed %s\n", seed);
|
||||
// If -proxy is in use, we make an ADDR_FETCH connection to the DNS resolved peer address
|
||||
// for the base dns seed domain in chainparams
|
||||
if (HaveNameProxy()) {
|
||||
@@ -2385,9 +2385,9 @@ void CConnman::ThreadDNSAddressSeed()
|
||||
}
|
||||
--seeds_right_now;
|
||||
}
|
||||
LogPrintf("%d addresses found from DNS seeds\n", found);
|
||||
LogInfo("%d addresses found from DNS seeds\n", found);
|
||||
} else {
|
||||
LogPrintf("Skipping DNS seeds. Enough peers have been found\n");
|
||||
LogInfo("Skipping DNS seeds. Enough peers have been found\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2568,7 +2568,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
|
||||
constexpr std::chrono::seconds ADD_NEXT_SEEDNODE = 10s;
|
||||
|
||||
if (!add_fixed_seeds) {
|
||||
LogPrintf("Fixed seeds are disabled\n");
|
||||
LogInfo("Fixed seeds are disabled\n");
|
||||
}
|
||||
|
||||
while (!m_interrupt_net->interrupted()) {
|
||||
@@ -2607,7 +2607,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
|
||||
// It is cheapest to check if enough time has passed first.
|
||||
if (GetTime<std::chrono::seconds>() > start + std::chrono::minutes{1}) {
|
||||
add_fixed_seeds_now = true;
|
||||
LogPrintf("Adding fixed seeds as 60 seconds have passed and addrman is empty for at least one reachable network\n");
|
||||
LogInfo("Adding fixed seeds as 60 seconds have passed and addrman is empty for at least one reachable network\n");
|
||||
}
|
||||
|
||||
// Perform cheap checks before locking a mutex.
|
||||
@@ -2615,7 +2615,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
|
||||
LOCK(m_added_nodes_mutex);
|
||||
if (m_added_node_params.empty()) {
|
||||
add_fixed_seeds_now = true;
|
||||
LogPrintf("Adding fixed seeds as -dnsseed=0 (or IPv4/IPv6 connections are disabled via -onlynet) and neither -addnode nor -seednode are provided\n");
|
||||
LogInfo("Adding fixed seeds as -dnsseed=0 (or IPv4/IPv6 connections are disabled via -onlynet) and neither -addnode nor -seednode are provided\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2634,7 +2634,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
|
||||
local.SetInternal("fixedseeds");
|
||||
addrman.Add(seed_addrs, local);
|
||||
add_fixed_seeds = false;
|
||||
LogPrintf("Added %d fixed seeds from reachable networks.\n", seed_addrs.size());
|
||||
LogInfo("Added %d fixed seeds from reachable networks.\n", seed_addrs.size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3158,7 +3158,7 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
|
||||
// the program was closed and restarted.
|
||||
if (sock->SetSockOpt(SOL_SOCKET, SO_REUSEADDR, &nOne, sizeof(int)) == SOCKET_ERROR) {
|
||||
strError = Untranslated(strprintf("Error setting SO_REUSEADDR on socket: %s, continuing anyway", NetworkErrorString(WSAGetLastError())));
|
||||
LogPrintf("%s\n", strError.original);
|
||||
LogInfo("%s\n", strError.original);
|
||||
}
|
||||
|
||||
// some systems don't have IPV6_V6ONLY but are always v6only; others do have the option
|
||||
@@ -3167,14 +3167,14 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
|
||||
#ifdef IPV6_V6ONLY
|
||||
if (sock->SetSockOpt(IPPROTO_IPV6, IPV6_V6ONLY, &nOne, sizeof(int)) == SOCKET_ERROR) {
|
||||
strError = Untranslated(strprintf("Error setting IPV6_V6ONLY on socket: %s, continuing anyway", NetworkErrorString(WSAGetLastError())));
|
||||
LogPrintf("%s\n", strError.original);
|
||||
LogInfo("%s\n", strError.original);
|
||||
}
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
int nProtLevel = PROTECTION_LEVEL_UNRESTRICTED;
|
||||
if (sock->SetSockOpt(IPPROTO_IPV6, IPV6_PROTECTION_LEVEL, &nProtLevel, sizeof(int)) == SOCKET_ERROR) {
|
||||
strError = Untranslated(strprintf("Error setting IPV6_PROTECTION_LEVEL on socket: %s, continuing anyway", NetworkErrorString(WSAGetLastError())));
|
||||
LogPrintf("%s\n", strError.original);
|
||||
LogInfo("%s\n", strError.original);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -3188,7 +3188,7 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
|
||||
LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", strError.original);
|
||||
return false;
|
||||
}
|
||||
LogPrintf("Bound to %s\n", addrBind.ToStringAddrPort());
|
||||
LogInfo("Bound to %s\n", addrBind.ToStringAddrPort());
|
||||
|
||||
// Listen for incoming connections
|
||||
if (sock->Listen(SOMAXCONN) == SOCKET_ERROR)
|
||||
@@ -3209,13 +3209,13 @@ void Discover()
|
||||
|
||||
for (const CNetAddr &addr: GetLocalAddresses()) {
|
||||
if (AddLocal(addr, LOCAL_IF))
|
||||
LogPrintf("%s: %s\n", __func__, addr.ToStringAddr());
|
||||
LogInfo("%s: %s\n", __func__, addr.ToStringAddr());
|
||||
}
|
||||
}
|
||||
|
||||
void CConnman::SetNetworkActive(bool active)
|
||||
{
|
||||
LogPrintf("%s: %s\n", __func__, active);
|
||||
LogInfo("%s: %s\n", __func__, active);
|
||||
|
||||
if (fNetworkActive == active) {
|
||||
return;
|
||||
@@ -3350,7 +3350,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
|
||||
if (m_anchors.size() > MAX_BLOCK_RELAY_ONLY_ANCHORS) {
|
||||
m_anchors.resize(MAX_BLOCK_RELAY_ONLY_ANCHORS);
|
||||
}
|
||||
LogPrintf("%i block-relay-only anchors will be tried for connections.\n", m_anchors.size());
|
||||
LogInfo("%i block-relay-only anchors will be tried for connections.\n", m_anchors.size());
|
||||
}
|
||||
|
||||
if (m_client_interface) {
|
||||
@@ -3384,7 +3384,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
|
||||
threadSocketHandler = std::thread(&util::TraceThread, "net", [this] { ThreadSocketHandler(); });
|
||||
|
||||
if (!gArgs.GetBoolArg("-dnsseed", DEFAULT_DNSSEED))
|
||||
LogPrintf("DNS seeding disabled\n");
|
||||
LogInfo("DNS seeding disabled\n");
|
||||
else
|
||||
threadDNSAddressSeed = std::thread(&util::TraceThread, "dnsseed", [this] { ThreadDNSAddressSeed(); });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user