feat: allow upnp to recover from errors

This commit is contained in:
Yat Ho 2024-03-04 16:14:43 +08:00
parent 821a6816ef
commit 62c8062bba
1 changed files with 2 additions and 2 deletions

View File

@ -306,7 +306,7 @@ tr_port_forwarding_state tr_upnpPulse(
freeUPNPDevlist(devlist);
}
if ((handle->state == UpnpState::Idle) && (handle->isMapped) &&
if ((handle->state <= UpnpState::Failed) && (handle->isMapped) &&
(!is_enabled || handle->advertised_port != advertised_port || handle->local_port != local_port))
{
handle->state = UpnpState::WillUnmap;
@ -339,7 +339,7 @@ tr_port_forwarding_state tr_upnpPulse(
handle->local_port = {};
}
if ((handle->state == UpnpState::Idle) && is_enabled && !handle->isMapped)
if ((handle->state <= UpnpState::Failed) && is_enabled && !handle->isMapped)
{
handle->state = UpnpState::WillMap;
}