From 9bd2529e2d03e65fe6d52bcd1190fdc5e2b0df45 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Mon, 17 Oct 2011 10:41:32 +0000
Subject: [PATCH] Fix bug introduced in rev 1.556: the protected node thead
 counter (node_threads_running) wasn't being re-initialized upon recycle, so
 the node would lock/crash attempting to lock an uninitialized mutex upon
 answering an incoming connection.

---
 src/sbbs3/main.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index 3dae0bfb86..acc76eb22a 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -4426,7 +4426,6 @@ void DLLCALL bbs_thread(void* arg)
 
 	uptime=0;
 	served=0;
-	protected_uint32_init(&node_threads_running,0);
 
 	startup->recycle_now=FALSE;
 	startup->shutdown_now=FALSE;
@@ -4436,6 +4435,8 @@ void DLLCALL bbs_thread(void* arg)
 
 	do {
 
+	protected_uint32_init(&node_threads_running,0);
+
 	thread_up(FALSE /* setuid */);
 
 	status("Initializing");
-- 
GitLab