+static void
+http_server_session_cleanup_cb (void *hs_handlep)
+{
+ http_session_t *hs;
+ uword hs_handle;
+ hs_handle = pointer_to_uword (hs_handlep);
+ hs = http_server_session_get (hs_handle >> 24, hs_handle & 0x00FFFFFF);
+ if (!hs)
+ return;
+ hs->timer_handle = ~0;
+ http_server_session_disconnect (hs);
+ http_server_session_cleanup (hs);
+}
+
+static void
+http_expired_timers_dispatch (u32 * expired_timers)
+{
+ u32 hs_handle;
+ int i;
+
+ for (i = 0; i < vec_len (expired_timers); i++)
+ {
+ /* Get session handle. The first bit is the timer id */
+ hs_handle = expired_timers[i] & 0x7FFFFFFF;
+ session_send_rpc_evt_to_thread (hs_handle >> 24,
+ http_server_session_cleanup_cb,
+ uword_to_pointer (hs_handle, void *));
+ }
+}
+
+static uword
+http_server_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
+ vlib_frame_t * f)
+{
+ http_server_main_t *hsm = &http_server_main;
+ f64 now, timeout = 1.0;
+ uword *event_data = 0;
+ uword __clib_unused event_type;
+
+ while (1)
+ {
+ vlib_process_wait_for_event_or_clock (vm, timeout);
+ now = vlib_time_now (vm);
+ event_type = vlib_process_get_events (vm, (uword **) & event_data);
+
+ /* expire timers */
+ clib_spinlock_lock (&http_server_main.tw_lock);
+ tw_timer_expire_timers_2t_1w_2048sl (&hsm->tw, now);
+ clib_spinlock_unlock (&http_server_main.tw_lock);
+
+ vec_reset_length (event_data);
+ }
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_REGISTER_NODE (http_server_process_node) =
+{
+ .function = http_server_process,
+ .type = VLIB_NODE_TYPE_PROCESS,
+ .name = "http-server-process",
+ .state = VLIB_NODE_STATE_DISABLED,
+};
+/* *INDENT-ON* */
+