session: fix allocation of proxy fifos
Fifos need to be synchronously allocated once a transport like tcp
accepts a session. Since events are now delivered asynchronously,
proxy apps must explicitly register a cb function that manages
fifo allocation prior to being notified of connect event.
Type: fix
Fixes: 0242d30
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I7df973b7014e53e0766ea2bdc61e9871160bc18b
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index d76b9f7..b41f7a4 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -74,6 +74,8 @@
/** Delegate fifo-tuning-logic to application */
int (*fifo_tuning_callback) (session_t * s, svm_fifo_t * f,
session_ft_action_t act, u32 bytes);
+ /** Custom fifo allocation for proxy */
+ int (*proxy_alloc_session_fifos) (session_t *s);
} session_cb_vft_t;
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index 192c22b..e345153 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -379,6 +379,7 @@
session_set_state (cs, SESSION_STATE_CONNECTING);
cs->app_wrk_index = client_wrk->wrk_index;
cs->connection_index = cct->c_c_index;
+ cs->opaque = opaque;
cct->c_s_index = cs->session_index;
/* This will allocate fifos for the session. They won't be used for
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 9e4b147..a806c4a 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -406,7 +406,7 @@
/* Allocate fifos for session, unless the app is a builtin proxy */
if (application_is_builtin_proxy (app))
- return 0;
+ return app->cb_fns.proxy_alloc_session_fifos (s);
sm = app_worker_get_connect_segment_manager (app_wrk);
return app_worker_alloc_session_fifos (sm, s);
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index b494041..1f73eef 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -920,6 +920,7 @@
s = session_alloc_for_connection (tc);
session_set_state (s, SESSION_STATE_CONNECTING);
s->app_wrk_index = app_wrk->wrk_index;
+ s->opaque = opaque;
new_si = s->session_index;
new_ti = s->thread_index;
@@ -1342,6 +1343,7 @@
app_wrk = app_worker_get (rmt->app_wrk_index);
s = session_alloc_for_connection (tc);
s->app_wrk_index = app_wrk->wrk_index;
+ s->opaque = rmt->opaque;
session_set_state (s, SESSION_STATE_OPENED);
if (app_worker_init_connected (app_wrk, s))
{