mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-26 23:09:03 +02:00
net: Add interrupt to pcp retry loop
Without this interrupt bitcoind takes a long time to exit if requested to do so after a failed pcp lookup on startup.
This commit is contained in:
@@ -74,11 +74,11 @@ static void ProcessPCP()
|
||||
// Open a port mapping on whatever local address we have toward the gateway.
|
||||
struct in_addr inaddr_any;
|
||||
inaddr_any.s_addr = htonl(INADDR_ANY);
|
||||
auto res = PCPRequestPortMap(pcp_nonce, *gateway4, CNetAddr(inaddr_any), private_port, requested_lifetime);
|
||||
auto res = PCPRequestPortMap(pcp_nonce, *gateway4, CNetAddr(inaddr_any), private_port, requested_lifetime, g_mapport_interrupt);
|
||||
MappingError* pcp_err = std::get_if<MappingError>(&res);
|
||||
if (pcp_err && *pcp_err == MappingError::UNSUPP_VERSION) {
|
||||
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "portmap: Got unsupported PCP version response, falling back to NAT-PMP\n");
|
||||
res = NATPMPRequestPortMap(*gateway4, private_port, requested_lifetime);
|
||||
res = NATPMPRequestPortMap(*gateway4, private_port, requested_lifetime, g_mapport_interrupt);
|
||||
}
|
||||
handle_mapping(res);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ static void ProcessPCP()
|
||||
// Try to open pinholes for all routable local IPv6 addresses.
|
||||
for (const auto &addr: GetLocalAddresses()) {
|
||||
if (!addr.IsRoutable() || !addr.IsIPv6()) continue;
|
||||
auto res = PCPRequestPortMap(pcp_nonce, *gateway6, addr, private_port, requested_lifetime);
|
||||
auto res = PCPRequestPortMap(pcp_nonce, *gateway6, addr, private_port, requested_lifetime, g_mapport_interrupt);
|
||||
handle_mapping(res);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user