Skip to content
Snippets Groups Projects
Commit 6c227319 authored by rswindell's avatar rswindell
Browse files

Don't allow active_clients counter to go negative.

parent c30e0acb
Branches
Tags
No related merge requests found
......@@ -1186,6 +1186,7 @@ static void pop3_thread(void* arg)
smb_freemsgmem(&msg);
smb_close(&smb);
if(active_clients)
active_clients--, update_clients();
client_off(socket);
......@@ -1637,6 +1638,7 @@ static void smtp_thread(void* arg)
lprintf("%04d !SMTP REFUSED SESSION from blacklisted server"
,socket);
thread_down();
if(active_clients)
active_clients--, update_clients();
return;
}
......@@ -1654,6 +1656,7 @@ static void smtp_thread(void* arg)
sockprintf(socket,sys_error);
mail_close_socket(socket);
thread_down();
if(active_clients)
active_clients--, update_clients();
return;
}
......@@ -2767,6 +2770,7 @@ static void smtp_thread(void* arg)
status(STATUS_WFC);
if(active_clients)
active_clients--, update_clients();
client_off(socket);
......@@ -3436,8 +3440,7 @@ void DLLCALL mail_server(void* arg)
lprintf("Maximum inactivity: %u seconds",startup->max_inactivity);
active_clients=0;
update_clients();
active_clients=0,update_clients();
/* open a socket and wait for a client */
......@@ -3719,7 +3722,7 @@ void DLLCALL mail_server(void* arg)
start=time(NULL);
while(active_clients) {
if(time(NULL)-start>TIMEOUT_THREAD_WAIT) {
lprintf("!TIMEOUT waiting for %u active clients ",active_clients);
lprintf("!TIMEOUT waiting for %d active clients ",active_clients);
break;
}
mswait(100);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment