diff --git a/src/sbbs3/atcodes.cpp b/src/sbbs3/atcodes.cpp index 8737e3046fc9d6ca8fb6ce1cad011794b2eec192..399dbd0dae1b9f77a0b750bcf861d96f393433fb 100644 --- a/src/sbbs3/atcodes.cpp +++ b/src/sbbs3/atcodes.cpp @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -146,7 +146,7 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen) } if(!strcmp(sp,"UPTIME")) { - extern time_t uptime; + extern volatile time_t uptime; time_t up=time(NULL)-uptime; if(up<0) up=0; @@ -164,7 +164,7 @@ const char* sbbs_t::atcode(char* sp, char* str, size_t maxlen) } if(!strcmp(sp,"SERVED")) { - extern DWORD served; + extern volatile ulong served; safe_snprintf(str,maxlen,"%lu",served); return(str); } diff --git a/src/sbbs3/ftpsrvr.c b/src/sbbs3/ftpsrvr.c index 4f163110c71bdbb7ebd69bca271f79287107fbe5..1d6fce90c546d4dcf30383633578fce1c09b4c63 100644 --- a/src/sbbs3/ftpsrvr.c +++ b/src/sbbs3/ftpsrvr.c @@ -79,12 +79,12 @@ static ftp_startup_t* startup=NULL; static scfg_t scfg; static SOCKET server_socket=INVALID_SOCKET; -static ulong active_clients=0; -static ulong sockets=0; -static ulong thread_count=0; -static time_t uptime=0; -static ulong served=0; -static BOOL terminate_server=FALSE; +static volatile ulong active_clients=0; +static volatile ulong sockets=0; +static volatile ulong thread_count=0; +static volatile time_t uptime=0; +static volatile ulong served=0; +static volatile BOOL terminate_server=FALSE; static char revision[16]; static char *text[TOTAL_TEXT]; static str_list_t recycle_semfiles; diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c index 5b0c85824651c6b0ae2950714fc9126a68d54de4..39b9c0219beb7e31f9861a1c6ec85f057c5ed793 100644 --- a/src/sbbs3/mailsrvr.c +++ b/src/sbbs3/mailsrvr.c @@ -80,7 +80,7 @@ static char* badrsp_err = "%s replied with:\r\n\"%s\"\r\n" "instead of the expected reply:\r\n\"%s ...\""; #define TIMEOUT_THREAD_WAIT 60 /* Seconds */ -#define DNSBL_THROTTLE_VALUE 5000 /* Milliseconds */ +#define DNSBL_THROTTLE_VALUE 1000 /* Milliseconds */ #define SPAM_HASH_SUBJECT_MIN_LEN 10 /* characters */ #define STATUS_WFC "Listening" @@ -90,34 +90,34 @@ static scfg_t scfg; static SOCKET server_socket=INVALID_SOCKET; static SOCKET submission_socket=INVALID_SOCKET; static SOCKET pop3_socket=INVALID_SOCKET; -static ulong active_clients=0; -static int active_sendmail=0; -static ulong thread_count=0; -static BOOL sendmail_running=FALSE; -static BOOL terminate_server=FALSE; -static BOOL terminate_sendmail=FALSE; +static volatile ulong active_clients=0; +static volatile int active_sendmail=0; +static volatile ulong thread_count=0; +static volatile BOOL sendmail_running=FALSE; +static volatile BOOL terminate_server=FALSE; +static volatile BOOL terminate_sendmail=FALSE; static sem_t sendmail_wakeup_sem; static char revision[16]; -static time_t uptime; +static volatile time_t uptime; static str_list_t recycle_semfiles; static str_list_t shutdown_semfiles; static int mailproc_count; static js_server_props_t js_server_props; struct { - ulong sockets; - ulong errors; - ulong crit_errors; - ulong connections_ignored; - ulong connections_refused; - ulong connections_served; - ulong pop3_served; - ulong smtp_served; + volatile ulong sockets; + volatile ulong errors; + volatile ulong crit_errors; + volatile ulong connections_ignored; + volatile ulong connections_refused; + volatile ulong connections_served; + volatile ulong pop3_served; + volatile ulong smtp_served; /* SMTP: */ - ulong sessions_refused; - ulong msgs_ignored; - ulong msgs_refused; - ulong msgs_received; + volatile ulong sessions_refused; + volatile ulong msgs_ignored; + volatile ulong msgs_refused; + volatile ulong msgs_received; } stats; struct mailproc { diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index aecca1800b47bad4ca920f4a0879c8f4ab699e67..017cf644d51cf222965198b861d76de26f46d7f3 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -76,11 +76,11 @@ #define SSH_END() #endif -time_t uptime=0; -DWORD served=0; +volatile time_t uptime=0; +volatile ulong served=0; -static ulong node_threads_running=0; -static ulong thread_count=0; +static volatile ulong node_threads_running=0; +static volatile ulong thread_count=0; char lastuseron[LEN_ALIAS+1]; /* Name of user last online */ RingBuf* node_inbuf[MAX_NODES]; @@ -305,7 +305,7 @@ DLLEXPORT void DLLCALL sbbs_srand() close(rf); } #else - seed = time(NULL) ^ (DWORD)GetCurrentThreadId() + seed = time(NULL) ^ (DWORD)GetCurrentThreadId(); #endif srand(seed); diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h index 38664941287e5d16376637272e726b35fcf5840e..abb50f2196a8c6b2a5c2f34ea1cfdbd76bc26948 100644 --- a/src/sbbs3/sbbs.h +++ b/src/sbbs3/sbbs.h @@ -969,7 +969,7 @@ extern "C" { const char* version_detail; uint32_t* interface_addr; uint32_t* options; - ulong* clients; + volatile ulong* clients; } js_server_props_t; enum { diff --git a/src/sbbs3/sbbsdefs.h b/src/sbbs3/sbbsdefs.h index ad4fb84a361801a1eef0023375e0bfa079e7f32a..5e4cb76860e2b885d7db1c1982083afdcd6352e9 100644 --- a/src/sbbs3/sbbsdefs.h +++ b/src/sbbs3/sbbsdefs.h @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -58,8 +58,8 @@ #define VERSION_NOTICE "Synchronet BBS for "PLATFORM_DESC\ " Version " VERSION #define SYNCHRONET_CRC 0x9BCDD162 -#define COPYRIGHT_NOTICE "Copyright 2010 Rob Swindell" -#define COPYRIGHT_CRC 0xA053FC9F +#define COPYRIGHT_NOTICE "Copyright 2011 Rob Swindell" +#define COPYRIGHT_CRC 0x3D5C1DE9 #define Y2K_2DIGIT_WINDOW 70 @@ -86,7 +86,7 @@ typedef struct { ulong gc_interval; ulong gc_attempts; BOOL auto_terminate; - BOOL* terminated; + volatile BOOL* terminated; str_list_t exit_func; } js_branch_t; diff --git a/src/sbbs3/services.c b/src/sbbs3/services.c index a4e741037da595e159ca3e9991e776a168be4b08..34e3c1573cc8f1e9ebfb2de2e7ca6faf910f9725 100644 --- a/src/sbbs3/services.c +++ b/src/sbbs3/services.c @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -69,10 +69,10 @@ static services_startup_t* startup=NULL; static scfg_t scfg; -static uint32_t sockets=0; -static BOOL terminated=FALSE; -static time_t uptime=0; -static uint32_t served=0; +static volatile ulong sockets=0; +static volatile BOOL terminated=FALSE; +static volatile time_t uptime=0; +static volatile ulong served=0; static char revision[16]; static str_list_t recycle_semfiles; static str_list_t shutdown_semfiles; @@ -91,11 +91,11 @@ typedef struct { js_startup_t js; js_server_props_t js_server_props; /* These are run-time state and stat vars */ - ulong clients; - ulong served; - SOCKET socket; - BOOL running; - BOOL terminated; + volatile ulong clients; + volatile ulong served; + volatile SOCKET socket; + volatile BOOL running; + volatile BOOL terminated; } service_t; typedef struct { diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c index 89e45ac6e3202db35c5865275c96654bf4326257..73e114620a71b2600675650435b39d4ec21531f0 100644 --- a/src/sbbs3/websrvr.c +++ b/src/sbbs3/websrvr.c @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -96,15 +96,14 @@ enum { }; static scfg_t scfg; -static BOOL scfg_reloaded=TRUE; -static BOOL http_logging_thread_running=FALSE; -static ulong active_clients=0; -static ulong sockets=0; -static BOOL terminate_server=FALSE; -static BOOL terminate_http_logging_thread=FALSE; -static ulong thread_count=0; -static SOCKET server_socket=INVALID_SOCKET; -static SOCKET server_socket6=INVALID_SOCKET; +static volatile BOOL http_logging_thread_running=FALSE; +static volatile ulong active_clients=0; +static volatile ulong sockets=0; +static volatile BOOL terminate_server=FALSE; +static volatile BOOL terminate_http_logging_thread=FALSE; +static volatile ulong thread_count=0; +static volatile SOCKET server_socket=INVALID_SOCKET; +static volatile SOCKET server_socket6=INVALID_SOCKET; static char revision[16]; static char root_dir[MAX_PATH+1]; static char error_dir[MAX_PATH+1]; @@ -112,14 +111,14 @@ static char temp_dir[MAX_PATH+1]; static char cgi_dir[MAX_PATH+1]; static char cgi_env_ini[MAX_PATH+1]; static char default_auth_list[MAX_PATH+1]; -static time_t uptime=0; -static ulong served=0; +static volatile time_t uptime=0; +static volatile ulong served=0; static web_startup_t* startup=NULL; static js_server_props_t js_server_props; static str_list_t recycle_semfiles; static str_list_t shutdown_semfiles; static str_list_t cgi_env; -static ulong session_threads=0; +static volatile ulong session_threads=0; static named_string_t** mime_types; static named_string_t** cgi_handlers; @@ -5478,7 +5477,6 @@ void DLLCALL web_server(void* arg) cleanup(1); return; } - scfg_reloaded=TRUE; lprintf(LOG_DEBUG,"Temporary file directory: %s", temp_dir); MKDIR(temp_dir);