X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fsession%2Fsession_node.c;h=30cd5ae9a4dfbc4ff0b09b08b56b946298a4eb1f;hb=f7f4e399e04774a6ca00b67006610f5b8f7a37c6;hp=bf0c3959471bc0a6566a1b0046f09d2419a0b17a;hpb=52207f1b7b60cb0784d5241f0a4d40eef531c67e;p=vpp.git diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index bf0c3959471..30cd5ae9a4d 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -68,6 +68,12 @@ session_mq_accepted_reply_handler (void *data) return; } s->session_state = SESSION_STATE_READY; + if (!svm_fifo_is_empty (s->server_rx_fifo)) + { + application_t *app; + app = application_get (s->app_index); + application_send_event (app, s, FIFO_EVENT_APP_RX); + } } } @@ -112,22 +118,24 @@ session_mq_disconnected_handler (void *data) svm_msg_q_msg_t _msg, *msg = &_msg; session_disconnected_msg_t *mp; session_event_t *evt; + stream_session_t *s; application_t *app; int rv = 0; mp = (session_disconnected_msg_t *) data; app = application_lookup (mp->client_index); - if (app) - { - a->handle = mp->handle; - a->app_index = app->index; - rv = vnet_disconnect_session (a); - } - else + s = session_get_from_handle_if_valid (mp->handle); + if (!(app && s && s->app_index == app->index)) { - rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED; + clib_warning ("could not disconnect session: %llu app: %u", mp->handle, + mp->client_index); + return; } + a->handle = mp->handle; + a->app_index = app->index; + rv = vnet_disconnect_session (a); + svm_msg_q_lock_and_alloc_msg_w_ring (app->event_queue, SESSION_MQ_CTRL_EVT_RING, SVM_Q_WAIT, msg); @@ -787,7 +795,7 @@ skip_dequeue: { stream_session_t *s; /* $$$ prefetch 1 ahead maybe */ session_event_t *e; - u32 to_dequeue; + u8 is_full; e = &fifo_events[i]; switch (e->event_type) @@ -806,7 +814,7 @@ skip_dequeue: clib_warning ("It's dead, Jim!"); continue; } - to_dequeue = svm_fifo_max_dequeue (s->server_tx_fifo); + is_full = svm_fifo_is_full (s->server_tx_fifo); /* Spray packets in per session type frames, since they go to * different nodes */ @@ -815,7 +823,7 @@ skip_dequeue: if (PREDICT_TRUE (rv == SESSION_TX_OK)) { /* Notify app there's tx space if not polling */ - if (PREDICT_FALSE (to_dequeue == s->server_tx_fifo->nitems + if (PREDICT_FALSE (is_full && !svm_fifo_has_event (s->server_tx_fifo))) session_dequeue_notify (s); }