diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index 4da9a36b9a6389d5a8d58ff88ae545281ef95ce7..eb8525b982035ea7f5309227f0915f9bd0e9664a 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -3343,7 +3343,7 @@ void DLLCALL bbs_thread(void* arg) time_t start; time_t initialized=0; node_t node; - sbbs_t* events; + sbbs_t* events=NULL; client_t client; startup=(bbs_startup_t*)arg; @@ -3638,15 +3638,17 @@ void DLLCALL bbs_thread(void* arg) } _beginthread(output_thread, 0, sbbs); - events = new sbbs_t(0, server_addr.sin_addr.s_addr - ,"BBS Events", INVALID_SOCKET, &scfg, text, NULL); - events->online = 0; - if(events->init()==false) { - lputs("!Events initialization failed"); - cleanup(1); - return; + if(!(startup->options&BBS_OPT_NO_EVENTS)) { + events = new sbbs_t(0, server_addr.sin_addr.s_addr + ,"BBS Events", INVALID_SOCKET, &scfg, text, NULL); + events->online = 0; + if(events->init()==false) { + lputs("!Events initialization failed"); + cleanup(1); + return; + } + _beginthread(event_thread, 0, events); } - _beginthread(event_thread, 0, events); /* Save these values incase they're changed dynamically */ first_node=startup->first_node; @@ -3986,7 +3988,8 @@ void DLLCALL bbs_thread(void* arg) } sbbs->client_socket=INVALID_SOCKET; - events->terminated=true; + if(events!=NULL) + events->terminated=true; // Wake-up BBS output thread so it can terminate sem_post(&sbbs->output_sem); @@ -4005,7 +4008,7 @@ void DLLCALL bbs_thread(void* arg) } // Wait for Events thread to terminate - if(events->event_thread_running) { + if(events!=NULL && events->event_thread_running) { pthread_mutex_unlock(&event_mutex); lprintf("Waiting for event thread to terminate..."); start=time(NULL); @@ -4040,7 +4043,7 @@ void DLLCALL bbs_thread(void* arg) sbbs->putnodedat(i,&node); } - if(!events->event_thread_running) + if(events!=NULL && !events->event_thread_running) delete events; if(!sbbs->output_thread_running) diff --git a/src/sbbs3/sbbs_ini.c b/src/sbbs3/sbbs_ini.c index 8e5ba5fe9a72a363f937826bf0c5ffed38afa6d7..04622fd51ceae6d280f16a6ec65333d12edce925 100644 --- a/src/sbbs3/sbbs_ini.c +++ b/src/sbbs3/sbbs_ini.c @@ -50,6 +50,7 @@ static ini_bitdesc_t bbs_options[] = { { BBS_OPT_USE_2ND_RLOGIN ,"USE_2ND_RLOGIN" }, { BBS_OPT_NO_QWK_EVENTS ,"NO_QWK_EVENTS" }, { BBS_OPT_NO_TELNET_GA ,"NO_TELNET_GA" }, + { BBS_OPT_NO_EVENTS ,"NO_EVENTS" }, { BBS_OPT_NO_HOST_LOOKUP ,"NO_HOST_LOOKUP" }, { BBS_OPT_NO_RECYCLE ,"NO_RECYCLE" }, { BBS_OPT_GET_IDENT ,"GET_IDENT" }, diff --git a/src/sbbs3/sbbscon.c b/src/sbbs3/sbbscon.c index 39102fc23503530c5914e7f64c42ab706c219252..97808b405fd90dc87d5042276656e84d6094481d 100644 --- a/src/sbbs3/sbbscon.c +++ b/src/sbbs3/sbbscon.c @@ -163,6 +163,7 @@ static const char* usage = "\nusage: %s [[setting] [...]] [path/ini_file]\n" "\tgi get user identity (using IDENT protocol)\n" "\tnh disable hostname lookups\n" "\tnj disable JavaScript support\n" + "\tne disable event thread\n" "\tni do not read settings from .ini file\n" #ifdef __unix__ "\tnd do not read run as daemon - overrides .ini file\n" @@ -1232,6 +1233,9 @@ int main(int argc, char** argv) case 'S': /* Services */ run_services=FALSE; break; + case 'E': /* No Events */ + bbs_startup.options |=BBS_OPT_NO_EVENTS; + break; case 'Q': /* No QWK events */ bbs_startup.options |=BBS_OPT_NO_QWK_EVENTS; break; diff --git a/src/sbbs3/startup.h b/src/sbbs3/startup.h index c945190a38a46afcd0cdbe61ee32b68b6a471d2c..8d0cd2d83c1059ff1536f5a0f2db9d7edcbd6900 100644 --- a/src/sbbs3/startup.h +++ b/src/sbbs3/startup.h @@ -105,6 +105,7 @@ typedef struct { #define BBS_OPT_USE_2ND_RLOGIN (1<<6) /* Use 2nd username in BSD RLogin */ #define BBS_OPT_NO_QWK_EVENTS (1<<7) /* Don't run QWK-related events */ #define BBS_OPT_NO_TELNET_GA (1<<8) /* Don't send periodic Telnet GAs */ +#define BBS_OPT_NO_EVENTS (1<<9) /* Don't run event thread */ #define BBS_OPT_NO_HOST_LOOKUP (1<<11) #define BBS_OPT_NO_RECYCLE (1<<27) /* Disable recycling of server */ #define BBS_OPT_GET_IDENT (1<<28) /* Get Identity (RFC 1413) */