session: fix cleanup in closing states 75/22475/2
authorFlorin Coras <[email protected]>
Tue, 24 Sep 2019 19:45:14 +0000 (12:45 -0700)
committerAndrew Yourtchenko <[email protected]>
Thu, 3 Oct 2019 08:44:24 +0000 (08:44 +0000)
Type: fix

Change-Id: Iccc283bb98d3bb459a711ec2b74d6a32ad12903b
Signed-off-by: Florin Coras <[email protected]>
(cherry picked from commit 54c93cfc2556d9c6d2cf472f51d4c2866a556ef6)

src/vnet/session/session.c
src/vnet/tcp/tcp.c

index cc9f4a8..47f7326 100644 (file)
@@ -1279,11 +1279,9 @@ session_transport_reset (session_t * s)
 void
 session_transport_cleanup (session_t * s)
 {
-  s->session_state = SESSION_STATE_CLOSED;
-
   /* Delete from main lookup table before we axe the the transport */
   session_lookup_del_session (s);
-  if (s->session_state != SESSION_STATE_TRANSPORT_DELETED)
+  if (s->session_state < SESSION_STATE_TRANSPORT_DELETED)
     transport_cleanup (session_get_transport_proto (s), s->connection_index,
                       s->thread_index);
   /* Since we called cleanup, no delete notification will come. So, make
index f32a709..75a45a4 100644 (file)
@@ -475,6 +475,8 @@ tcp_session_cleanup (u32 conn_index, u32 thread_index)
 {
   tcp_connection_t *tc;
   tc = tcp_connection_get (conn_index, thread_index);
+  if (!tc)
+    return;
   tcp_connection_set_state (tc, TCP_STATE_CLOSED);
   tcp_connection_cleanup (tc);
 }