void http_client_free(struct http_client_pool *client_pool, struct http_client_context *cctx) { if (cctx->persistent) { int fd = RIBS_RESERVED_TO_CONTEXT(cctx)->fd; epoll_worker_set_fd_ctx(fd, idle_ctx); uint32_t ofs = hashtable_lookup(&ht_persistent_clients, &cctx->key, sizeof(struct http_client_key)); struct list *head; if (0 == ofs) { if (list_empty(&free_list)) { close(fd); return; } head = list_pop_head(&free_list); uint32_t h = head - client_heads; hashtable_insert(&ht_persistent_clients, &cctx->key, sizeof(struct http_client_key), &h, sizeof(h)); list_init(head); } else head = client_heads + *(uint32_t *)hashtable_get_val(&ht_persistent_clients, ofs); struct list *client = client_chains + fd; list_insert_head(head, client); } ctx_pool_put(&client_pool->ctx_pool, RIBS_RESERVED_TO_CONTEXT(cctx)); }
static void http_server_fiber_main_wrapper(void) { http_server_fiber_main(); struct http_server_context *ctx = http_server_get_context(); ctx_pool_put(&ctx->server->ctx_pool, current_ctx); }
static void http_server_fiber_main_wrapper(void) { http_server_fiber_main(); struct http_server *server = (struct http_server *)current_ctx->data.ptr; ctx_pool_put(&server->ctx_pool, current_ctx); }