From 2193439c6ce5eb64f72d964a12a59f134664ca3c Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Thu, 7 Jun 2001 12:47:17 +0000 Subject: [PATCH] Fixed long delay (virtual hang) when shutting down (deleting event sbbs_t) caused by unnecessary call to hangup(). Events destructor now displays "BBS Events" rather than the last event node number (cosmetic only). sbbs->output_thread only shows stats if bytes were sent (cosmetic only). --- src/sbbs3/main.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index 82aaea8f96..d5416363e8 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -773,6 +773,7 @@ void input_thread(void *arg) void output_thread(void* arg) { char node[128]; + char stats[128]; BYTE buf[IO_THREAD_BUF_SIZE]; int i; ulong avail; @@ -849,8 +850,13 @@ void output_thread(void* arg) sbbs->output_thread_running = false; - lprintf("%s output thread terminated (sent %lu bytes in %lu packets)" - ,node, total_sent, total_pkts); + if(total_sent) + sprintf(stats,"(sent %lu bytes in %lu packets)" + ,total_sent, total_pkts); + else + stats[0]=0; + + lprintf("%s output thread terminated %s", node, stats); thread_down(); } @@ -903,7 +909,7 @@ void event_thread(void* arg) sprintf(str,"%stime.dab",sbbs->cfg.ctrl_dir); if((file=sbbs->nopen(str,O_RDWR|O_CREAT))==-1) { sbbs->errormsg(WHERE,ERR_OPEN,str,0); - return; + break; } for(i=0;i<sbbs->cfg.total_events;i++) { sbbs->cfg.event[i]->last=0; @@ -934,7 +940,7 @@ void event_thread(void* arg) sprintf(str,"%spnet.dab",sbbs->cfg.ctrl_dir); if((file=sbbs->nopen(str,O_RDWR|O_CREAT))==-1) { sbbs->errormsg(WHERE,ERR_OPEN,str,0); - return; + break; } for(i=0;i<sbbs->cfg.total_phubs;i++) { sbbs->cfg.phub[i]->last=0; @@ -1394,6 +1400,7 @@ void event_thread(void* arg) mswait(startup->event_interval*1000); } + sbbs->cfg.node_num=0; sbbs->event_thread_running = false; eprintf("BBS Event thread terminated"); @@ -1884,7 +1891,9 @@ sbbs_t::~sbbs_t() lprintf("%s destructor begin", node); +#if 0 // Removed Jun-07-2001 causing long delay when shutting down hangup(); /* close socket handle */ +#endif if(client_socket_dup!=INVALID_SOCKET) closesocket(client_socket_dup); /* close duplicate handle */ -- GitLab