mirror of
https://github.com/moonlight-stream/Internet-Hosting-Tool.git
synced 2025-07-01 23:35:27 +00:00
Avoid making duplicate NAT-PMP requests to a UPnP gateway that was disconnected
This commit is contained in:
parent
9dd169ba02
commit
c47014887a
@ -606,6 +606,14 @@ void UpdatePortMappingsForTarget(bool enable, char* targetAddressIP4, char* inte
|
||||
tryNatPmp = false;
|
||||
}
|
||||
|
||||
// Don't try with NAT-PMP if the UPnP attempt for the same gateway failed due to being
|
||||
// disconnected or some other error. This will avoid overwriting UPnP rules on a disconnected IGD
|
||||
// with duplicate NAT-PMP rules. We want to allow deletion of NAT-PMP rules in any case though.
|
||||
if (tryNatPmp && enable && !strcmp(upstreamAddrNatPmp, upstreamAddrNatPmp)) {
|
||||
printf("Not attempting to use NAT-PMP to talk to the same UPnP gateway\n");
|
||||
tryNatPmp = false;
|
||||
}
|
||||
|
||||
if (tryNatPmp) {
|
||||
bool success = true;
|
||||
for (int i = 0; i < ARRAYSIZE(k_Ports); i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user