+
+ /* Make sure we don't try to send anything more */
+ svm_fifo_dequeue_drop_all (s->server_tx_fifo);
+
+ switch (s->session_state)
+ {
+ case SESSION_STATE_TRANSPORT_CLOSING:
+ /* If transport finishes or times out before we get a reply
+ * from the app, do the whole disconnect since we might still
+ * have lingering events. Cleanup session table in advance
+ * because transport will soon be closed and closed sessions
+ * are assumed to have been removed from the lookup table */
+ session_lookup_del_session (s);
+ 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:
+ stream_session_delete (s);
+ break;
+ }