+ break;
+ case TCP_STATE_FIN_WAIT_1:
+ tcp_connection_timers_reset (tc);
+ if (tc->flags & TCP_CONN_FINPNDG)
+ {
+ /* If FIN pending send it before closing and wait as long as
+ * the rto timeout would wait. Notify session layer that transport
+ * is closed. We haven't sent everything but we did try. */
+ tcp_cong_recovery_off (tc);
+ tcp_send_fin (tc);
+ tcp_timer_set (tc, TCP_TIMER_WAITCLOSE,
+ clib_max (tc->rto * TCP_TO_TIMER_TICK, 1));
+ session_stream_close_notify (&tc->connection);
+ }
+ else
+ {
+ /* We've sent the fin but no progress. Close the connection and
+ * to make sure everything is flushed, setup a cleanup timer */
+ tcp_connection_set_state (tc, TCP_STATE_CLOSED);
+ tcp_timer_set (tc, TCP_TIMER_WAITCLOSE, TCP_CLEANUP_TIME);
+ }
+ break;
+ case TCP_STATE_LAST_ACK:
+ case TCP_STATE_CLOSING:
+ tcp_connection_timers_reset (tc);
+ tcp_connection_set_state (tc, TCP_STATE_CLOSED);
+ tcp_timer_set (tc, TCP_TIMER_WAITCLOSE, TCP_CLEANUP_TIME);
+ session_stream_close_notify (&tc->connection);
+ break;
+ default:
+ tcp_connection_del (tc);
+ break;