From dcfd74dfd62c35a5e6a055dfd4589dd143beaccc Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Sat, 11 Jul 2009 14:39:34 +0000
Subject: [PATCH] Don't bother reading from the server if the client already
 hung up on us.

---
 jcc.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/jcc.c b/jcc.c
index ed17ba82..c24075c8 100644
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.264 2009/07/07 16:42:26 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.265 2009/07/11 11:17:35 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -1867,6 +1867,16 @@ static void chat(struct client_state *csp)
        */
       if (FD_ISSET(csp->sfd, &rfds))
       {
+#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+         if (!socket_is_still_usable(csp->cfd))
+         {
+            log_error(LOG_LEVEL_CONNECT,
+               "The server still wants to talk, but the client hung up on us.");
+            mark_server_socket_tainted(csp);
+            return;
+         }
+#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
+
          fflush(NULL);
          len = read_socket(csp->sfd, buf, sizeof(buf) - 1);
 
-- 
2.50.1