struct http_client_context *cctx;
struct http_client_settings set;
+ struct http_client *prev, *next;
+
struct event *event;
struct ioloop *ioloop;
struct ssl_iostream_context *ssl_ctx;
struct http_client_settings set;
+ struct http_client *clients_list;
struct connection_list *conn_list;
HASH_TABLE_TYPE(http_client_peer_shared) peers;
#include "net.h"
#include "str.h"
#include "hash.h"
+#include "llist.h"
#include "array.h"
#include "ioloop.h"
#include "istream.h"
static struct http_client_context *http_client_global_context = NULL;
+static void
+http_client_context_add_client(struct http_client_context *cctx,
+ struct http_client *client);
+static void
+http_client_context_remove_client(struct http_client_context *cctx,
+ struct http_client *client);
+
/*
* Client
*/
i_array_init(&client->delayed_failing_requests, 1);
+ http_client_context_add_client(cctx, client);
+
return client;
}
if (client->ssl_ctx != NULL)
ssl_iostream_context_unref(&client->ssl_ctx);
+ http_client_context_remove_client(client->cctx, client);
http_client_context_unref(&client->cctx);
event_unref(&client->event);
pool_unref(&client->pool);
pool_unref(&cctx->pool);
}
+static void
+http_client_context_add_client(struct http_client_context *cctx,
+ struct http_client *client)
+{
+ DLLIST_PREPEND(&cctx->clients_list, client);
+}
+
+static void
+http_client_context_remove_client(struct http_client_context *cctx,
+ struct http_client *client)
+{
+ DLLIST_REMOVE(&cctx->clients_list, client);
+}
+
void http_client_context_switch_ioloop(struct http_client_context *cctx)
{
struct connection *_conn = cctx->conn_list->connections;