+static inline void
+vls_mp_checks (vcl_locked_session_t * vls, int is_add)
+{
+ vcl_worker_t *wrk = vcl_worker_get_current ();
+ vcl_session_t *s;
+
+ s = vcl_session_get (wrk, vls->session_index);
+ switch (s->session_state)
+ {
+ case STATE_LISTEN:
+ if (is_add)
+ {
+ if (vls->worker_index == wrk->wrk_index)
+ vls_listener_wrk_set (vls, wrk->wrk_index, 1 /* is_active */ );
+ break;
+ }
+ vls_listener_wrk_stop_listen (vls, vls->worker_index);
+ break;
+ case STATE_LISTEN_NO_MQ:
+ if (!is_add)
+ break;
+
+ /* Register worker as listener */
+ vls_listener_wrk_start_listen (vls, wrk->wrk_index);
+
+ /* If owner worker did not attempt to accept/xpoll on the session,
+ * force a listen stop for it, since it may not be interested in
+ * accepting new sessions.
+ * This is pretty much a hack done to give app workers the illusion
+ * that it is fine to listen and not accept new sessions for a
+ * given listener. Without it, we would accumulate unhandled
+ * accepts on the passive worker message queue. */
+ if (!vls_listener_wrk_is_active (vls, vls->worker_index))
+ vls_listener_wrk_stop_listen (vls, vls->worker_index);
+ break;
+ default:
+ break;
+ }
+}
+