summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAloys Augustin <aloaugus@cisco.com>2019-04-09 11:25:56 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-04-16 16:20:24 +0000
commitb3b267cf59682560846847c96dbd62b453ad0d01 (patch)
tree96a946a0d5b303123053a5e38eb919eb727a0d1c
parentcbb8f589638c2634b44ee2de24c76696f983645a (diff)
Allow sessions to be allocated in app's RX callbacks
This enables applications to create sessions in their RX callbacks, which can invalidate the session pointer. This is required for the QUIC protocol implementation. Change-Id: I6072c1c368fd9d17a960ec086a788089dd6f54b4 Signed-off-by: Aloys Augustin <aloaugus@cisco.com>
-rw-r--r--src/vnet/session/session.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 31539dfd6c3..90248b64401 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -492,6 +492,11 @@ static inline int
session_enqueue_notify_inline (session_t * s)
{
app_worker_t *app_wrk;
+ u32 session_index;
+ u8 n_subscribers;
+
+ session_index = s->session_index;
+ n_subscribers = svm_fifo_n_subscribers (s->rx_fifo);
app_wrk = app_worker_get_if_valid (s->app_wrk_index);
if (PREDICT_FALSE (!app_wrk))
@@ -512,9 +517,12 @@ session_enqueue_notify_inline (session_t * s)
SESSION_IO_EVT_RX)))
return -1;
- if (PREDICT_FALSE (svm_fifo_n_subscribers (s->rx_fifo)))
- return session_notify_subscribers (app_wrk->app_index, s,
- s->rx_fifo, SESSION_IO_EVT_RX);
+ if (PREDICT_FALSE (n_subscribers))
+ {
+ s = session_get (session_index, vlib_get_thread_index ());
+ return session_notify_subscribers (app_wrk->app_index, s,
+ s->rx_fifo, SESSION_IO_EVT_RX);
+ }
return 0;
}