+static void
+ct_accept_rpc_wrk_handler (void *rpc_args)
+{
+ u32 thread_index, ho_index, n_connects, i, n_pending;
+ const u32 max_connects = 32;
+ ct_worker_t *wrk;
+
+ thread_index = pointer_to_uword (rpc_args);
+ wrk = ct_worker_get (thread_index);
+
+ /* Sub without lock as main enqueues with worker barrier */
+ n_pending = clib_fifo_elts (wrk->pending_connects);
+ n_connects = clib_min (n_pending, max_connects);
+
+ for (i = 0; i < n_connects; i++)
+ {
+ clib_fifo_sub1 (wrk->pending_connects, ho_index);
+ ct_accept_one (thread_index, ho_index);
+ }
+
+ if (n_pending == n_connects)
+ wrk->have_connects = 0;
+ else
+ session_send_rpc_evt_to_thread_force (
+ thread_index, ct_accept_rpc_wrk_handler,
+ uword_to_pointer (thread_index, void *));
+}
+