mirror of https://github.com/bitcoin/bitcoin.git
Merge bitcoin/bitcoin#33311: net: Quiet down logging when router doesn't support natpmp/pcp
4f1a4cbccd
net: Quiet down logging when router doesn't support natpmp/pcp (laanwj) Pull request description: 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 message that is already in the debug category. However, there's also the case in which sending an UDP packet causes a ICMP response (type 3, code 3 "port unreachable"). 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. ACKs for top commit: willcl-ark: utACK4f1a4cbccd
sipa: utACK4f1a4cbccd
davidgumberg: Tested ACK4f1a4cbccd
achow101: ACK4f1a4cbccd
darosior: utACK4f1a4cbccd
mzumsande: utACK4f1a4cbccd
Tree-SHA512: 2c99a5679720482ece47af33616b6b207509fb58ba1962a1c2d30f8d0e68554f8f5ef25224313d93f4c5a1cc702183fcf8e6119abc411209c9884119ef680aad
This commit is contained in:
commit
647cdb4f7e
|
@ -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