Browse code

-yet another fix (immediately release bad connection, don't try to read from it)

Andrei Pelinescu-Onciul authored on 04/11/2003 22:52:18
Showing 1 changed files
... ...
@@ -403,7 +403,7 @@ int tcp_read_req(struct tcp_connection* con)
403 403
 				resp=CONN_ERROR;
404 404
 				goto end_req;
405 405
 			}
406
-		if(con->state!=S_CONN_OK) goto end_req; /* not enough data */
406
+			if(con->state!=S_CONN_OK) goto end_req; /* not enough data */
407 407
 		}
408 408
 #endif
409 409
 
... ...
@@ -630,6 +630,15 @@ skip:
630 630
 				DBG("tcp receive: list fd=%d, id=%d, timeout=%d, refcnt=%d\n",
631 631
 						con->fd, con->id, con->timeout, con->refcnt);
632 632
 #endif
633
+				if (con->state<0){
634
+					/* S_CONN_BAD or S_CONN_ERROR, remove it */
635
+					resp=CONN_ERROR;
636
+					FD_CLR(con->fd, &master_set);
637
+					tcpconn_listrm(list, con, c_next, c_prev);
638
+					con->state=S_CONN_BAD;
639
+					release_tcpconn(con, resp, unix_sock);
640
+					continue;
641
+				}
633 642
 				if (nfds && FD_ISSET(con->fd, &sel_set)){
634 643
 #ifdef EXTRA_DEBUG
635 644
 					DBG("tcp receive: match, fd:isset\n");