- struct timeval timeout = {timeout_ms / 1000, (timeout_ms % 1000) * 1000};
-
- if (event_initialized(pool->timeout) && event_pending(pool->timeout, EV_TIMEOUT, NULL)) {
+ struct timeval timeout;
+
+ if (!event_initialized(pool->timeout)) {
+ event_set(pool->timeout, -1, 0, http_request_pool_timeout_callback, pool);
+ event_base_set(HTTP_G->request.pool.event.base, pool->timeout);
+ } else if (event_pending(pool->timeout, EV_TIMEOUT, NULL)) {