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