Skip to content

Commit 83c4413

Browse files
committed
Remove port forwarding entries when MISS is stopped
1 parent 15d60ed commit 83c4413

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

miss/miss.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,14 @@ HandlerEx(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpConte
628628
return NO_ERROR;
629629

630630
case SERVICE_CONTROL_STOP:
631+
ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
632+
ServiceStatus.dwControlsAccepted = 0;
633+
SetServiceStatus(ServiceStatusHandle, &ServiceStatus);
634+
635+
printf("Removing UPnP/NAT-PMP rules after service stop request\n");
636+
UpdatePortMappings(false);
637+
638+
printf("The service is stopping\n");
631639
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
632640
SetServiceStatus(ServiceStatusHandle, &ServiceStatus);
633641
return NO_ERROR;

0 commit comments

Comments
 (0)