Przeglądaj źródła

Don't send a second FIN if we receive a FIN while in FIN_WAIT_2

tags/v0.9.3
Michael Brown 18 lat temu
rodzic
commit
be31970e36
1 zmienionych plików z 6 dodań i 5 usunięć
  1. 6
    5
      src/net/tcp.c

+ 6
- 5
src/net/tcp.c Wyświetl plik

@@ -573,13 +573,14 @@ static int tcp_rx_fin ( struct tcp_connection *conn, uint32_t seq ) {
573 573
 	if ( ( conn->rcv_ack - seq ) > 0 )
574 574
 		return 0;
575 575
 
576
-	/* Mark FIN as received and send our own FIN */
577
-	conn->tcp_state |= ( TCP_STATE_RCVD ( TCP_FIN ) |
578
-			     TCP_STATE_SENDING ( TCP_FIN ) );
579
-
580
-	/* Acknowledge FIN */
576
+	/* Mark FIN as received and acknowledge it */
577
+	conn->tcp_state |= TCP_STATE_RCVD ( TCP_FIN );
581 578
 	conn->rcv_ack++;
582 579
 
580
+	/* If we haven't already sent our FIN, send a FIN */
581
+	if ( ! ( conn->tcp_state & TCP_STATE_ACKED ( TCP_FIN ) ) )
582
+		conn->tcp_state |= TCP_STATE_SENDING ( TCP_FIN );
583
+
583 584
 	/* Break association with application */
584 585
 	tcp_disassociate ( conn );
585 586
 

Ładowanie…
Anuluj
Zapisz