void death_queue_kill(struct death_queue *dq, struct lwan_connection *conn) { death_queue_remove(dq, conn); if (LIKELY(conn->coro)) { coro_free(conn->coro); conn->coro = NULL; } if (conn->flags & CONN_IS_ALIVE) { conn->flags &= ~CONN_IS_ALIVE; close(lwan_connection_get_fd(dq->lwan, conn)); } }
static ALWAYS_INLINE void destroy_coro(struct death_queue_t *dq, lwan_connection_t *conn) { death_queue_remove(dq, conn); if (LIKELY(conn->coro)) { coro_free(conn->coro); conn->coro = NULL; } if (conn->flags & CONN_IS_ALIVE) { conn->flags &= ~CONN_IS_ALIVE; close(lwan_connection_get_fd(dq->lwan, conn)); } }
static void death_queue_move_to_last(struct death_queue_t *dq, lwan_connection_t *conn) { /* * If the connection isn't keep alive, it might have a coroutine that * should be resumed. If that's the case, schedule for this request to * die according to the keep alive timeout. * * If it's not a keep alive connection, or the coroutine shouldn't be * resumed -- then just mark it to be reaped right away. */ conn->time_to_die = dq->time + dq->keep_alive_timeout * (unsigned)!!(conn->flags & (CONN_KEEP_ALIVE | CONN_SHOULD_RESUME_CORO)); death_queue_remove(dq, conn); death_queue_insert(dq, conn); }