From 91f82462d9fc0decd4d5f3fe1949788000429410 Mon Sep 17 00:00:00 2001
From: erickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Date: Fri, 4 Nov 2005 23:32:53 +0000
Subject: [PATCH] fixed bug where removing a node didn't always register

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@568 9efc2488-bf62-4759-914b-345cdb29e865
---
 src/utils/socket_bundle.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/utils/socket_bundle.c b/src/utils/socket_bundle.c
index b3f1683..41012c5 100644
--- a/src/utils/socket_bundle.c
+++ b/src/utils/socket_bundle.c
@@ -425,7 +425,7 @@ int socket_wait_all(socket_manager* mgr, int timeout) {
 int _socket_route_data(
 	socket_manager* mgr, int num_active, fd_set* read_set) {
 
-	if(mgr == NULL) return -1;
+	if(!(mgr && read_set)) return -1;
 
 	int last_failed_id = -1;
 
@@ -460,7 +460,7 @@ int _socket_route_data(
 				if(node->endpoint == SERVER_SOCKET) 
 					_socket_handle_new_client(mgr, node);
 	
-				if(node->endpoint == CLIENT_SOCKET ) 
+				else
 					status = _socket_handle_client_data(mgr, node);
 	
 				/* someone may have yanked a socket_node out from under 
@@ -552,7 +552,8 @@ int _socket_handle_client_data(socket_manager* mgr, socket_node* node) {
 			if( errno != EAGAIN ) 
 				warning_handler( " * Error reading socket with errno %d", errno );
 		}
-	}
+
+	} else { return -1; } /* inform the caller that this node has been tampered with */
 
 	if(read_bytes == 0) {  /* socket closed by client */
 		if(mgr->on_socket_closed) {
-- 
2.11.0