Lines Matching refs:pool

200 static void evrpc_pool_schedule(struct evrpc_pool *pool);
512 struct evrpc_pool *pool = mm_calloc(1, sizeof(struct evrpc_pool)); in evrpc_pool_new() local
513 if (pool == NULL) in evrpc_pool_new()
516 TAILQ_INIT(&pool->connections); in evrpc_pool_new()
517 TAILQ_INIT(&pool->requests); in evrpc_pool_new()
519 TAILQ_INIT(&pool->paused_requests); in evrpc_pool_new()
521 TAILQ_INIT(&pool->input_hooks); in evrpc_pool_new()
522 TAILQ_INIT(&pool->output_hooks); in evrpc_pool_new()
524 pool->base = base; in evrpc_pool_new()
525 pool->timeout = -1; in evrpc_pool_new()
527 return (pool); in evrpc_pool_new()
540 evrpc_pool_free(struct evrpc_pool *pool) in evrpc_pool_free() argument
548 while ((request = TAILQ_FIRST(&pool->requests)) != NULL) { in evrpc_pool_free()
549 TAILQ_REMOVE(&pool->requests, request, next); in evrpc_pool_free()
553 while ((pause = TAILQ_FIRST(&pool->paused_requests)) != NULL) { in evrpc_pool_free()
554 TAILQ_REMOVE(&pool->paused_requests, pause, next); in evrpc_pool_free()
558 while ((connection = TAILQ_FIRST(&pool->connections)) != NULL) { in evrpc_pool_free()
559 TAILQ_REMOVE(&pool->connections, connection, next); in evrpc_pool_free()
563 while ((hook = TAILQ_FIRST(&pool->input_hooks)) != NULL) { in evrpc_pool_free()
564 r = evrpc_remove_hook(pool, EVRPC_INPUT, hook); in evrpc_pool_free()
568 while ((hook = TAILQ_FIRST(&pool->output_hooks)) != NULL) { in evrpc_pool_free()
569 r = evrpc_remove_hook(pool, EVRPC_OUTPUT, hook); in evrpc_pool_free()
573 mm_free(pool); in evrpc_pool_free()
582 evrpc_pool_add_connection(struct evrpc_pool *pool, in evrpc_pool_add_connection() argument
586 TAILQ_INSERT_TAIL(&pool->connections, connection, next); in evrpc_pool_add_connection()
591 if (pool->base != NULL) in evrpc_pool_add_connection()
592 evhttp_connection_set_base(connection, pool->base); in evrpc_pool_add_connection()
599 connection->timeout = pool->timeout; in evrpc_pool_add_connection()
606 if (TAILQ_FIRST(&pool->requests) != NULL) { in evrpc_pool_add_connection()
608 TAILQ_FIRST(&pool->requests); in evrpc_pool_add_connection()
609 TAILQ_REMOVE(&pool->requests, request, next); in evrpc_pool_add_connection()
615 evrpc_pool_remove_connection(struct evrpc_pool *pool, in evrpc_pool_remove_connection() argument
618 TAILQ_REMOVE(&pool->connections, connection, next); in evrpc_pool_remove_connection()
622 evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs) in evrpc_pool_set_timeout() argument
625 TAILQ_FOREACH(evcon, &pool->connections, next) { in evrpc_pool_set_timeout()
628 pool->timeout = timeout_in_secs; in evrpc_pool_set_timeout()
640 evrpc_pool_find_connection(struct evrpc_pool *pool) in evrpc_pool_find_connection() argument
643 TAILQ_FOREACH(connection, &pool->connections, next) { in evrpc_pool_find_connection()
665 struct evrpc_pool *pool = ctx->pool; in evrpc_schedule_request() local
680 if (TAILQ_FIRST(&pool->output_hooks) != NULL) { in evrpc_schedule_request()
686 hook_res = evrpc_process_hooks(&pool->output_hooks, in evrpc_schedule_request()
694 if (evrpc_pause_request(pool, ctx, in evrpc_schedule_request()
725 struct evrpc_pool *pool = ctx->pool; in evrpc_schedule_request_closure() local
737 if (pool->timeout > 0) { in evrpc_schedule_request_closure()
743 tv.tv_sec = pool->timeout; in evrpc_schedule_request_closure()
804 struct evrpc_pool *pool = ctx->pool; in evrpc_make_request() local
807 evtimer_assign(&ctx->ev_timeout, pool->base, evrpc_request_timeout, ctx); in evrpc_make_request()
810 EVUTIL_ASSERT(TAILQ_FIRST(&pool->connections) != NULL); in evrpc_make_request()
816 TAILQ_INSERT_TAIL(&pool->requests, ctx, next); in evrpc_make_request()
818 evrpc_pool_schedule(pool); in evrpc_make_request()
826 struct evrpc_pool *pool, void *request, void *reply, in evrpc_make_request_ctx() argument
839 ctx->pool = pool; in evrpc_make_request_ctx()
865 struct evrpc_pool *pool = ctx->pool; in evrpc_reply_done() local
879 if (TAILQ_FIRST(&pool->input_hooks) != NULL) { in evrpc_reply_done()
883 hook_res = evrpc_process_hooks(&pool->input_hooks, in evrpc_reply_done()
900 evrpc_pause_request(pool, ctx, in evrpc_reply_done()
920 struct evrpc_pool *pool = ctx->pool; in evrpc_reply_done_closure() local
953 evrpc_pool_schedule(pool); in evrpc_reply_done_closure()
957 evrpc_pool_schedule(struct evrpc_pool *pool) in evrpc_pool_schedule() argument
959 struct evrpc_request_wrapper *ctx = TAILQ_FIRST(&pool->requests); in evrpc_pool_schedule()
966 if ((evcon = evrpc_pool_find_connection(pool)) != NULL) { in evrpc_pool_schedule()
967 TAILQ_REMOVE(&pool->requests, ctx, next); in evrpc_pool_schedule()
1082 evrpc_send_request_generic(struct evrpc_pool *pool, in evrpc_send_request_generic() argument
1093 ctx = evrpc_make_request_ctx(pool, request, reply, in evrpc_send_request_generic()
1157 return (ctx->pool); in evrpc_request_get_pool()
1162 struct evrpc_pool *pool) in evrpc_request_set_pool() argument
1164 ctx->pool = pool; in evrpc_request_set_pool()