From 3aaff933e8ced135ae8a2dd1cf7b6fd150f5724d Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Tue, 27 Dec 2005 20:40:39 +0000
Subject: [PATCH] Writing to a client that was disconnecting and blocked could
 cause the server to crash.  (Bug 1403). * src/server/connections.c
 (check_idle_callback): Don't crash if isc_enable() fails.  Emit the session
 number in the log, mostly for debug purposes.

---
 ChangeLog                |  8 ++++++++
 src/server/connections.c | 15 +++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b0549ffe2..9a5f0a9bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-12-24  Per Cederqvist  <ceder@lysator.liu.se>
+
+	Writing to a client that was disconnecting and blocked could cause
+	the server to crash.  (Bug 1403).
+	* src/server/connections.c (check_idle_callback): Don't crash if
+	isc_enable() fails.  Emit the session number in the log, mostly
+	for debug purposes.
+
 2005-12-23  Per Cederqvist  <ceder@lysator.liu.se>
 
 	Add automake-generated files to svn:ignore.
diff --git a/src/server/connections.c b/src/server/connections.c
index c3bb81e2b..d7d69d202 100644
--- a/src/server/connections.c
+++ b/src/server/connections.c
@@ -1106,13 +1106,16 @@ check_idle_callback(oop_source *UNUSED(source),
 	next = next->queue_next;
 	c->queue_next = NULL;
 	if (isc_enable(c->isc_session) < 0)
-	    restart_kom("failed to re-enable session\n");
-
-	/* The call to read_from_connection() might add the
-	   connection to the queue.  That's why we remove all entries
-	   first, and use a private queue within this function.  */
-	if (!go_and_die)
+	{
+	    kom_log("failed to re-enable session %ld\n", (long)c->session_no);
+	}
+	else if (!go_and_die)
+	{
+	    /* The call to read_from_connection() might add the
+	       connection to the queue.  That's why we remove all entries
+	       first, and use a private queue within this function.  */
 	    read_from_connection(c);
+	}
     }
 
     if (!is_idle)
-- 
GitLab