diff options
-rw-r--r-- | src/vnet/session/session_node.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index 7565b43b29b..1d7ebf9f11a 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -454,19 +454,10 @@ session_mq_accepted_reply_handler (void *data) app_worker_t *app_wrk; session_t *s; - /* Server isn't interested, kill the session */ - if (mp->retval) - { - a->app_index = mp->context; - a->handle = mp->handle; - vnet_disconnect_session (a); - return; - } - /* Mail this back from the main thread. We're not polling in main * thread so we're using other workers for notifications. */ - if (vlib_num_workers () && vlib_get_thread_index () != 0 - && session_thread_from_handle (mp->handle) == 0) + if (session_thread_from_handle (mp->handle) == 0 && vlib_num_workers () && + vlib_get_thread_index () != 0) { vlib_rpc_call_main_thread (session_mq_accepted_reply_handler, (u8 *) mp, sizeof (*mp)); @@ -484,27 +475,35 @@ session_mq_accepted_reply_handler (void *data) return; } - if (!session_has_transport (s)) + /* Server isn't interested, disconnect the session */ + if (mp->retval) { - s->session_state = SESSION_STATE_READY; - if (ct_session_connect_notify (s, SESSION_E_NONE)) - return; + a->app_index = mp->context; + a->handle = mp->handle; + vnet_disconnect_session (a); + return; } - else + + /* Special handling for cut-through sessions */ + if (!session_has_transport (s)) { - old_state = s->session_state; s->session_state = SESSION_STATE_READY; + ct_session_connect_notify (s, SESSION_E_NONE); + return; + } - if (!svm_fifo_is_empty_prod (s->rx_fifo)) - app_worker_lock_and_send_event (app_wrk, s, SESSION_IO_EVT_RX); + old_state = s->session_state; + s->session_state = SESSION_STATE_READY; - /* Closed while waiting for app to reply. Resend disconnect */ - if (old_state >= SESSION_STATE_TRANSPORT_CLOSING) - { - app_worker_close_notify (app_wrk, s); - s->session_state = old_state; - return; - } + if (!svm_fifo_is_empty_prod (s->rx_fifo)) + app_worker_lock_and_send_event (app_wrk, s, SESSION_IO_EVT_RX); + + /* Closed while waiting for app to reply. Resend disconnect */ + if (old_state >= SESSION_STATE_TRANSPORT_CLOSING) + { + app_worker_close_notify (app_wrk, s); + s->session_state = old_state; + return; } } |