s = session_get (tc->s_index, tc->thread_index);
ASSERT (s->thread_index == vlib_get_thread_index ());
- ASSERT (s->session_state < SESSION_STATE_TRANSPORT_DELETED);
+ ASSERT (s->session_state != SESSION_STATE_TRANSPORT_DELETED);
if (!(s->flags & SESSION_F_CUSTOM_TX))
{
s->flags |= SESSION_F_CUSTOM_TX;
/* Session was created but accept notification was not yet sent to the
* app. Cleanup everything. */
session_lookup_del_session (s);
- session_free_w_fifos (s);
+ segment_manager_dealloc_fifos (s->rx_fifo, s->tx_fifo);
+ session_free (s);
break;
case SESSION_STATE_ACCEPTING:
case SESSION_STATE_TRANSPORT_CLOSING:
* session is just removed because both transport and app have
* confirmed the close*/
session_lookup_del_session (s);
- s->session_state = SESSION_STATE_CLOSED;
+ s->session_state = SESSION_STATE_TRANSPORT_DELETED;
session_cleanup_notify (s, SESSION_CLEANUP_TRANSPORT);
svm_fifo_dequeue_drop_all (s->tx_fifo);
session_program_transport_ctrl_evt (s, SESSION_CTRL_EVT_CLOSE);
{
/* Delete from main lookup table before we axe the the transport */
session_lookup_del_session (s);
- transport_cleanup (session_get_transport_proto (s), s->connection_index,
- s->thread_index);
+ 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
* sure the session is properly freed. */
session_free_w_fifos (s);