Skip to content
Snippets Groups Projects
Commit 9c198067 authored by rswindell's avatar rswindell
Browse files

services_terminate() no longer closes service sockets to signal shutdown

(apparent cause of Win32 lock-up when closing socket from non-owner thread)
using bool terminate instead, which doesn't abort select(), so using
shorter default sem_chk_freq value (2 seconds vs 5).
parent 52676685
No related branches found
No related tags found
No related merge requests found
...@@ -1419,15 +1419,10 @@ void DLLCALL services_terminate(void) ...@@ -1419,15 +1419,10 @@ void DLLCALL services_terminate(void)
{ {
DWORD i; DWORD i;
lprintf(LOG_INFO,"0000 Services terminate");
terminated=TRUE; terminated=TRUE;
for(i=0;i<services;i++) { for(i=0;i<services;i++)
if(service[i].socket==INVALID_SOCKET) service[i].terminated=TRUE;
continue;
if(service[i].options&SERVICE_OPT_STATIC)
continue;
close_socket(service[i].socket);
service[i].socket=INVALID_SOCKET;
}
} }
#define NEXT_FIELD(p) FIND_WHITESPACE(p); SKIP_WHITESPACE(p) #define NEXT_FIELD(p) FIND_WHITESPACE(p); SKIP_WHITESPACE(p)
...@@ -1577,7 +1572,8 @@ static void cleanup(int code) ...@@ -1577,7 +1572,8 @@ static void cleanup(int code)
#endif #endif
thread_down(); thread_down();
lprintf(LOG_DEBUG,"#### Services thread terminated (%lu clients served)",served); if(terminated || code)
lprintf(LOG_DEBUG,"#### Services thread terminated (%lu clients served)",served);
status("Down"); status("Down");
if(startup!=NULL && startup->terminated!=NULL) if(startup!=NULL && startup->terminated!=NULL)
startup->terminated(startup->cbdata,code); startup->terminated(startup->cbdata,code);
...@@ -1656,7 +1652,7 @@ void DLLCALL services_thread(void* arg) ...@@ -1656,7 +1652,7 @@ void DLLCALL services_thread(void* arg)
#endif #endif
/* Setup intelligent defaults */ /* Setup intelligent defaults */
if(startup->sem_chk_freq==0) startup->sem_chk_freq=5; if(startup->sem_chk_freq==0) startup->sem_chk_freq=2;
if(startup->js_max_bytes==0) startup->js_max_bytes=JAVASCRIPT_MAX_BYTES; if(startup->js_max_bytes==0) startup->js_max_bytes=JAVASCRIPT_MAX_BYTES;
if(startup->js_cx_stack==0) startup->js_cx_stack=JAVASCRIPT_CONTEXT_STACK; if(startup->js_cx_stack==0) startup->js_cx_stack=JAVASCRIPT_CONTEXT_STACK;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment