Remove port forwarding entries when MISS is stopped

This commit is contained in:
Cameron Gutman 2018-10-22 09:33:18 -07:00
parent 15d60ed10a
commit 83c4413926

View File

@ -628,6 +628,14 @@ HandlerEx(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpConte
return NO_ERROR;
case SERVICE_CONTROL_STOP:
ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
ServiceStatus.dwControlsAccepted = 0;
SetServiceStatus(ServiceStatusHandle, &ServiceStatus);
printf("Removing UPnP/NAT-PMP rules after service stop request\n");
UpdatePortMappings(false);
printf("The service is stopping\n");
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
SetServiceStatus(ServiceStatusHandle, &ServiceStatus);
return NO_ERROR;