Improve deletion of port mapping

This commit is contained in:
Stone_Red
2023-12-13 23:21:13 +01:00
parent 8a587ee627
commit 6f8d15ec88
@@ -94,14 +94,7 @@ public class ApiManager
{ {
try try
{ {
IEnumerable<Mapping>? mappings = device.GetAllMappingsAsync().GetAwaiter().GetResult(); device.DeletePortMapAsync(portMapping).GetAwaiter().GetResult();
foreach (Mapping? mapping in mappings)
{
if (mapping.Description.Contains("HyperbolicDowloader") && mapping.PrivateIP.ToString() == portMapping?.PrivateIP.ToString())
{
device.DeletePortMapAsync(mapping).GetAwaiter().GetResult();
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {