+
+ clib_mem_free (args);
+}
+
+static int
+ct_connect (app_worker_t * client_wrk, session_t * ll,
+ session_endpoint_cfg_t * sep)
+{
+ ct_accept_rpc_args_t *args;
+ ct_main_t *cm = &ct_main;
+ u32 thread_index;
+
+ /* Simple round-robin policy for spreading sessions over workers. We skip
+ * thread index 0, i.e., offset the index by 1, when we have workers as it
+ * is the one dedicated to main thread. Note that n_workers does not include
+ * main thread */
+ cm->n_sessions += 1;
+ thread_index = cm->n_workers ? (cm->n_sessions % cm->n_workers) + 1 : 0;
+
+ args = clib_mem_alloc (sizeof (*args));
+ args->ll_s_index = ll->session_index;
+ args->thread_index = thread_index;
+ clib_memcpy_fast (&args->ip, &sep->ip, sizeof (ip46_address_t));
+ args->port = sep->port;
+ args->is_ip4 = sep->is_ip4;
+ args->opaque = sep->opaque;
+ args->client_wrk_index = client_wrk->wrk_index;
+
+ session_send_rpc_evt_to_thread (thread_index, ct_accept_rpc_wrk_handler,
+ args);