ソースを参照

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

tags/v0.9.3
Michael Brown 18年前
コミット
be31970e36
1個のファイルの変更6行の追加5行の削除
  1. 6
    5
      src/net/tcp.c

+ 6
- 5
src/net/tcp.c ファイルの表示

@@ -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
 

読み込み中…
キャンセル
保存