void h2o_dispose_request(h2o_req_t *req) { /* close the generator if it is still open */ if (req->_generator != NULL) { /* close generator */ if (req->_generator->stop != NULL) req->_generator->stop(req->_generator, req); req->_generator = NULL; } /* close the ostreams still open */ while (req->_ostr_top->next != NULL) { if (req->_ostr_top->stop != NULL) req->_ostr_top->stop(req->_ostr_top, req); req->_ostr_top = req->_ostr_top->next; } h2o_timeout_unlink(&req->_timeout_entry); if (req->version != 0 && req->host_config != NULL) { h2o_logger_t **logger = req->host_config->loggers.entries, **end = logger + req->host_config->loggers.size; for (; logger != end; ++logger) { (*logger)->log_access((*logger), req); } } h2o_mempool_clear(&req->pool); }
static h2o_accept_ctx_t *free_accept_data(struct st_h2o_accept_data_t *data) { h2o_accept_ctx_t *ctx = data->ctx; h2o_timeout_unlink(&data->timeout); free(data); return ctx; }
static h2o_accept_ctx_t *free_accept_data(struct st_h2o_accept_data_t *data) { h2o_accept_ctx_t *ctx = data->ctx; assert(data->async_resumption_get_req == NULL); h2o_timeout_unlink(&data->timeout); free(data); return ctx; }
static void close_connection(struct st_h2o_http1_conn_t *conn, int close_socket) { h2o_timeout_unlink(&conn->_timeout_entry); h2o_dispose_request(&conn->req); if (conn->sock != NULL && close_socket) h2o_socket_close(conn->sock); free(conn); }
void h2o_socketpool_unregister_loop(h2o_socketpool_t *pool, h2o_loop_t *loop) { if (pool->_interval_cb.loop != loop) return; h2o_timeout_unlink(&pool->_interval_cb.entry); h2o_timeout_dispose(loop, &pool->_interval_cb.timeout); pool->_interval_cb.loop = NULL; }
static void update_idle_timeout(h2o_http2_conn_t *conn) { h2o_timeout_unlink(&conn->_timeout_entry); if (conn->num_streams.responding == 0) { assert(h2o_linklist_is_empty(&conn->_pending_reqs)); conn->_timeout_entry.cb = on_idle_timeout; h2o_timeout_link(conn->super.ctx->loop, &conn->super.ctx->http2.idle_timeout, &conn->_timeout_entry); } }
static void set_timeout(struct st_h2o_http1_conn_t *conn, h2o_timeout_t *timeout, h2o_timeout_cb cb) { if (conn->_timeout != NULL) { h2o_timeout_unlink(&conn->_timeout_entry); conn->_timeout_entry.cb = NULL; } conn->_timeout = timeout; if (timeout != NULL) { h2o_timeout_link(conn->super.ctx->loop, timeout, &conn->_timeout_entry); conn->_timeout_entry.cb = cb; } }
void h2o_socketpool_dispose(h2o_socketpool_t *pool) { pthread_mutex_lock(&pool->_shared.mutex); while (!h2o_linklist_is_empty(&pool->_shared.sockets)) { struct pool_entry_t *entry = H2O_STRUCT_FROM_MEMBER(struct pool_entry_t, link, pool->_shared.sockets.next); destroy_attached(entry); __sync_sub_and_fetch(&pool->_shared.count, 1); } pthread_mutex_unlock(&pool->_shared.mutex); pthread_mutex_destroy(&pool->_shared.mutex); if (pool->_interval_cb.loop != NULL) { h2o_timeout_unlink(&pool->_interval_cb.entry); h2o_timeout_dispose(pool->_interval_cb.loop, &pool->_interval_cb.timeout); } if (pool->peer.is_named) free(pool->peer.named.host.base); }
void h2o_socketpool_dispose(h2o_socketpool_t *pool) { pthread_mutex_lock(&pool->_shared.mutex); while (!h2o_linklist_is_empty(&pool->_shared.sockets)) { struct pool_entry_t *entry = H2O_STRUCT_FROM_MEMBER(struct pool_entry_t, link, pool->_shared.sockets.next); destroy_attached(entry); __sync_sub_and_fetch(&pool->_shared.count, 1); } pthread_mutex_unlock(&pool->_shared.mutex); pthread_mutex_destroy(&pool->_shared.mutex); if (pool->_interval_cb.loop != NULL) { h2o_timeout_unlink(&pool->_interval_cb.entry); h2o_timeout_dispose(pool->_interval_cb.loop, &pool->_interval_cb.timeout); } free(pool->peer.host.base); switch (pool->type) { case H2O_SOCKETPOOL_TYPE_NAMED: free(pool->peer.named_serv.base); break; case H2O_SOCKETPOOL_TYPE_SOCKADDR: break; } }
static void free_accept_data(struct st_h2o_accept_data_t *data) { assert(data->async_resumption_get_req == NULL); h2o_timeout_unlink(&data->timeout); free(data); }