Lines Matching refs:ppool
102 struct http_client_peer_pool *ppool;
104 ppool = i_new(struct http_client_peer_pool, 1);
105 ppool->refcount = 1;
106 ppool->peer = pshared;
107 ppool->event = event_create(pshared->cctx->event);
108 event_set_append_log_prefix(ppool->event, t_strdup_printf(
113 i_array_init(&ppool->conns, 16);
114 i_array_init(&ppool->pending_conns, 16);
115 i_array_init(&ppool->idle_conns, 16);
117 DLLIST_PREPEND(&pshared->pools_list, ppool);
119 ppool->ssl_ctx = ssl_ctx;
120 ppool->rawlog_dir = i_strdup(rawlog_dir);
122 e_debug(ppool->event, "Peer pool created");
124 return ppool;
127 void http_client_peer_pool_ref(struct http_client_peer_pool *ppool)
129 if (ppool->destroyed)
131 ppool->refcount++;
136 struct http_client_peer_pool *ppool = *_ppool;
140 http_client_peer_pool_ref(ppool);
143 t_array_init(&conns, array_count(&ppool->conns));
144 array_copy(&conns.arr, 0, &ppool->conns.arr, 0, array_count(&ppool->conns));
147 i_assert(array_count(&ppool->idle_conns) == 0);
148 i_assert(array_count(&ppool->pending_conns) == 0);
149 i_assert(array_count(&ppool->conns) == 0);
156 struct http_client_peer_pool *ppool = *_ppool;
157 struct http_client_peer_shared *pshared = ppool->peer;
161 if (ppool->destroyed)
164 i_assert(ppool->refcount > 0);
165 if (--ppool->refcount > 0)
168 e_debug(ppool->event, "Peer pool destroy");
169 ppool->destroyed = TRUE;
171 i_assert(array_count(&ppool->idle_conns) == 0);
172 i_assert(array_count(&ppool->conns) == 0);
173 array_free(&ppool->idle_conns);
174 array_free(&ppool->pending_conns);
175 array_free(&ppool->conns);
177 DLLIST_REMOVE(&pshared->pools_list, ppool);
179 event_unref(&ppool->event);
180 i_free(ppool->rawlog_dir);
181 i_free(ppool);
189 struct http_client_peer_pool *ppool;
196 ppool = pshared->pools_list;
197 while (ppool != NULL) {
198 if (ppool->ssl_ctx == ssl_ctx &&
199 null_strcmp(ppool->rawlog_dir, rawlog_dir) == 0)
201 ppool = ppool->next;
204 if (ppool == NULL) {
205 ppool = http_client_peer_pool_create
208 e_debug(ppool->event, "Peer pool reused");
209 http_client_peer_pool_ref(ppool);
212 return ppool;
217 struct http_client_peer_pool *ppool)
219 e_debug(ppool->event, "Successfully connected (connections=%u)",
220 array_count(&ppool->conns));
222 http_client_peer_shared_connection_success(ppool->peer);
227 struct http_client_peer_pool *ppool, const char *reason)
232 pending = array_count(&ppool->pending_conns);
235 e_debug(ppool->event,
238 array_count(&ppool->conns), pending);
240 http_client_peer_shared_connection_failure(ppool->peer,
556 peer->ppool = http_client_peer_pool_get(pshared, client);
623 struct http_client_peer_pool *ppool = peer->ppool;
661 http_client_peer_pool_unref(&ppool);
735 struct http_client_peer_pool *ppool = peer->ppool;
743 idle_conns = array_get(&ppool->idle_conns, &idle_count);
793 if (array_count(&peer->ppool->idle_conns) > 0)
1182 struct http_client_peer_pool *ppool = peer->ppool;
1187 http_client_peer_pool_connection_success(ppool);
1220 struct http_client_peer_pool *ppool = peer->ppool;
1222 http_client_peer_pool_connection_failure(ppool, reason);