mirror of https://github.com/bitcoin/bitcoin.git
net: Quiet down logging when router doesn't support natpmp/pcp
When the router doesn't support natpmp and PCP, one'd normally expect the UDP packet to be ignored, and hit a time out. This logs a warning that is already in the debug category. However, there's also the case in which sending an UDP packet causes a ICMP response. This is returned to user space as "connection refused" (despite UDP having no concept of connections). Move the warnings from `Send` and `Recv` to debug level too, to reduce log spam in that case. Closes #33301.
This commit is contained in:
parent
e1ce0c525c
commit
4f1a4cbccd
|
@ -230,7 +230,7 @@ std::optional<std::vector<uint8_t>> PCPSendRecv(Sock &sock, const std::string &p
|
|||
}
|
||||
// Dispatch packet to gateway.
|
||||
if (sock.Send(request.data(), request.size(), 0) != static_cast<ssize_t>(request.size())) {
|
||||
LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "%s: Could not send request: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
|
||||
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "%s: Could not send request: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
|
||||
return std::nullopt; // Network-level error, probably no use retrying.
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ std::optional<std::vector<uint8_t>> PCPSendRecv(Sock &sock, const std::string &p
|
|||
// Receive response.
|
||||
recvsz = sock.Recv(response, sizeof(response), MSG_DONTWAIT);
|
||||
if (recvsz < 0) {
|
||||
LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "%s: Could not receive response: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
|
||||
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "%s: Could not receive response: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
|
||||
return std::nullopt; // Network-level error, probably no use retrying.
|
||||
}
|
||||
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "%s: Received response of %d bytes: %s\n", protocol, recvsz, HexStr(std::span(response, recvsz)));
|
||||
|
|
Loading…
Reference in New Issue