Pārlūkot izejas kodu

tcp: minor fix: TCP_EV_CONNECT_RST() not always called

The TCP_EV_CONNECT_RST() macro was not called, when a received RST
was "signaled" by a poll/epoll/.. error, because the tcp
connection state was destroyed before it was checked.
(minor impact, only logging was affected)

Reported-and-tested-by: Libor Chocholaty <[email protected]>
Reported-and-tested-by: Jan Pewner <[email protected]>
Andrei Pelinescu-Onciul 16 gadi atpakaļ
vecāks
revīzija
8984eb5e4a
1 mainītis faili ar 4 papildinājumiem un 4 dzēšanām
  1. 4 4
      tcp_main.c

+ 4 - 4
tcp_main.c

@@ -3493,10 +3493,6 @@ inline static int handle_tcpconn_ev(struct tcp_connection* tcpconn, short ev,
 			}
 			tcpconn->flags&=~(F_CONN_WRITE_W|F_CONN_READ_W|
 								F_CONN_WANTS_RD|F_CONN_WANTS_WR);
-			if (unlikely(!tcpconn_try_unhash(tcpconn))){
-				LOG(L_CRIT, "BUG: tcpconn_ev: unhashed connection %p\n",
-							tcpconn);
-			}
 			if (unlikely(ev & POLLERR)){
 				if (unlikely(tcpconn->state==S_CONN_CONNECT)){
 #ifdef USE_DST_BLACKLIST
@@ -3517,6 +3513,10 @@ inline static int handle_tcpconn_ev(struct tcp_connection* tcpconn, short ev,
 					TCP_STATS_CON_RESET(); /* FIXME: it could != RST */
 				}
 			}
+			if (unlikely(!tcpconn_try_unhash(tcpconn))){
+				LOG(L_CRIT, "BUG: tcpconn_ev: unhashed connection %p\n",
+							tcpconn);
+			}
 			tcpconn_put_destroy(tcpconn);
 			goto error;
 		}