From ce71ea53bae782a0b49aa2a677dce39289a75f2d Mon Sep 17 00:00:00 2001 From: deuce <> Date: Fri, 20 Feb 2009 00:05:40 +0000 Subject: [PATCH] Make client_socket close race condition window much smaller. This *has* caused a crash in the wild. --- src/sbbs3/main.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index 1b48a359c0..8e01944a42 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -1993,6 +1993,8 @@ void output_thread(void* arg) tv.tv_usec=1000; FD_ZERO(&socket_set); + if(sbbs->client_socket==INVALID_SOCKET) // Make the race condition less likely to actually happen... TODO: Fix race + continue; FD_SET(sbbs->client_socket,&socket_set); i=select(sbbs->client_socket+1,NULL,&socket_set,NULL,&tv); @@ -5398,6 +5400,3 @@ NO_PASSTHRU: } while(!terminate_server); } - - - -- GitLab