fixed bug where removing a node didn't always register
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 4 Nov 2005 23:32:53 +0000 (23:32 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 4 Nov 2005 23:32:53 +0000 (23:32 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@568 9efc2488-bf62-4759-914b-345cdb29e865

src/utils/socket_bundle.c

index b3f1683..41012c5 100644 (file)
@@ -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) {