X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fsession%2Fsession.c;h=81c93064d38dd185cd6ef35475c14e8668dec398;hb=c01d578a625fb136bc33b0eb9c19907769a67989;hp=372a6f93a95ca416aacb1cdaf544eefccf352e62;hpb=ef91534e665cf343af2389df11d46559a1f83d78;p=vpp.git diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index 372a6f93a95..81c93064d38 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -153,7 +153,7 @@ session_free (stream_session_t * s) memset (s, 0xFA, sizeof (*s)); } -static void +void session_free_w_fifos (stream_session_t * s) { segment_manager_dealloc_fifos (s->svm_segment_index, s->server_rx_fifo, @@ -197,7 +197,7 @@ session_alloc_for_connection (transport_connection_t * tc) s = session_alloc (thread_index); s->session_type = session_type_from_proto_and_ip (tc->proto, tc->is_ip4); s->session_state = SESSION_STATE_CONNECTING; - s->enqueue_epoch = ~0; + s->enqueue_epoch = (u64) ~ 0; /* Attach transport to session and vice versa */ s->connection_index = tc->c_index; @@ -393,7 +393,7 @@ session_enqueue_stream_connection (transport_connection_t * tc, * by calling stream_server_flush_enqueue_events () */ session_manager_main_t *smm = vnet_get_session_manager_main (); u32 thread_index = s->thread_index; - u32 enqueue_epoch = smm->current_enqueue_epoch[tc->proto][thread_index]; + u64 enqueue_epoch = smm->current_enqueue_epoch[tc->proto][thread_index]; if (s->enqueue_epoch != enqueue_epoch) { @@ -434,7 +434,7 @@ session_enqueue_dgram_connection (stream_session_t * s, * by calling stream_server_flush_enqueue_events () */ session_manager_main_t *smm = vnet_get_session_manager_main (); u32 thread_index = s->thread_index; - u32 enqueue_epoch = smm->current_enqueue_epoch[proto][thread_index]; + u64 enqueue_epoch = smm->current_enqueue_epoch[proto][thread_index]; if (s->enqueue_epoch != enqueue_epoch) { @@ -760,6 +760,8 @@ stream_session_disconnect_notify (transport_connection_t * tc) stream_session_t *s; s = session_get (tc->s_index, tc->thread_index); + if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSING) + return; s->session_state = SESSION_STATE_TRANSPORT_CLOSING; app_wrk = app_worker_get_if_valid (s->app_wrk_index); if (!app_wrk) @@ -812,17 +814,22 @@ stream_session_delete_notify (transport_connection_t * tc) * from the app, do the whole disconnect since we might still * have lingering events */ stream_session_disconnect (s); + s->session_state = SESSION_STATE_CLOSED; break; case SESSION_STATE_CLOSING: /* Cleanup lookup table. Transport needs to still be valid */ session_lookup_del_session (s); + s->session_state = SESSION_STATE_CLOSED; break; case SESSION_STATE_CLOSED: + case SESSION_STATE_ACCEPTING: stream_session_delete (s); break; + default: + /* Assume connection was not yet added the lookup table */ + session_free_w_fifos (s); + break; } - - s->session_state = SESSION_STATE_CLOSED; } /**