From 5a4d699e74359c00a47b6c8e63fa51f9ebaddf84 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Tue, 18 Mar 2014 19:33:53 +0000
Subject: [PATCH] Log more meaningful error/warning messages and terminate the
 handle_call() loop immediately upon socket receive error (e.g. 54,
 ECONNRESET).

---
 src/sexpots/sexpots.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/sexpots/sexpots.c b/src/sexpots/sexpots.c
index 04f0158fb2..9636db4126 100644
--- a/src/sexpots/sexpots.c
+++ b/src/sexpots/sexpots.c
@@ -1290,8 +1290,19 @@ BOOL handle_call(void)
 				lprintf(LOG_WARNING,"Socket Disconnected");
 				break;
 			}
-			lprintf(LOG_ERR,"SOCKET RECV ERROR %d",ERROR_VALUE);
-			continue;
+			if(ERROR_VALUE == EAGAIN)
+				continue;
+        	else if(ERROR_VALUE == ENOTSOCK)
+   	            lprintf(LOG_WARNING,"Socket closed by peer on receive");
+       	    else if(ERROR_VALUE==ECONNRESET) 
+				lprintf(LOG_WARNING,"Connection reset by peer on receive");
+			else if(ERROR_VALUE==ESHUTDOWN)
+				lprintf(LOG_WARNING,"Socket shutdown on receive");
+       	    else if(ERROR_VALUE==ECONNABORTED) 
+				lprintf(LOG_WARNING,"Connection aborted by peer on receive");
+			else
+				lprintf(LOG_ERR,"SOCKET RECV ERROR %d",ERROR_VALUE);
+			break;
 		}
 
 		if(telnet)
-- 
GitLab