Fix idea: Supplicant service hanging with "Stopping" situation
George S. Lockwood
gslockwood
Mon Oct 9 14:38:34 PDT 2006
Adding the following code in service_start(...) between the
CreateThread( ......svc_thread...) and svc_status.dwControlsAccepted =
... lines seems to help with the Supplicant service hanging with
"Stopping" situation.
if (CreateThread(0, 0, (LPTHREAD_START_ROUTINE) svc_thread, 0, 0, &id)
== 0) {
printf("CreateThread failed: %d\n", (int) GetLastError());
return;
}
//// original code
//svc_status.dwCurrentState = SERVICE_RUNNING;
//svc_status.dwWaitHint = 0;
// if either of these cases were changed, you need to keep the
previous settings
// of svc_status.dwCurrentState and dwWaitHint
//case SERVICE_CONTROL_SHUTDOWN:
//case SERVICE_CONTROL_STOP:
if( svc_status.dwCurrentState != SERVICE_STOP_PENDING )
{
svc_status.dwCurrentState = SERVICE_RUNNING;
svc_status.dwWaitHint = 0;
}
svc_status.dwControlsAccepted = SERVICE_ACCEPT_STOP |
SERVICE_ACCEPT_PAUSE_CONTINUE |
SERVICE_ACCEPT_SHUTDOWN;
if (!SetServiceStatus(svc_status_handle, &svc_status)) {
printf("SetServiceStatus() failed: %d\n",
(int) GetLastError());
return;
}
/* wait until service gets killed */
WaitForSingleObject(kill_svc, INFINITE);
george
More information about the Hostap
mailing list