if (conn->opts & RSPAMD_HTTP_CLIENT_KEEP_ALIVE) {
rspamd_http_context_push_keepalive (conn->priv->ctx, conn,
msg, conn->priv->ctx->ev_base);
+ rspamd_http_connection_reset (conn);
}
else {
conn->finished = TRUE;
if (conn->opts & RSPAMD_HTTP_CLIENT_KEEP_ALIVE) {
rspamd_http_context_push_keepalive (conn->priv->ctx, conn,
msg, conn->priv->ctx->ev_base);
+ rspamd_http_connection_reset (conn);
}
else {
conn->finished = TRUE;
if (conn->opts & RSPAMD_HTTP_CLIENT_KEEP_ALIVE) {
rspamd_http_context_push_keepalive (conn->priv->ctx, conn,
priv->msg, conn->priv->ctx->ev_base);
+ rspamd_http_connection_reset (conn);
}
else {
conn->finished = TRUE;
return NULL;
}
+ if (ctx == NULL) {
+ ctx = rspamd_http_context_default ();
+ }
+
conn = rspamd_http_context_check_keepalive (ctx, addr, host);
if (conn) {
static const int default_kp_size = 1024;
static const gdouble default_rotate_time = 120;
+ static const gdouble default_keepalive_interval = 65;
static const gchar *default_user_agent = "rspamd-" RSPAMD_VERSION_FULL;
ctx = g_malloc0 (sizeof (*ctx));
ctx->config.kp_cache_size_server = default_kp_size;
ctx->config.client_key_rotate_time = default_rotate_time;
ctx->config.user_agent = default_user_agent;
+ ctx->config.keepalive_interval = default_keepalive_interval;
if (cfg) {
ctx->ssl_ctx = cfg->libs_ctx->ssl_ctx;
ctx->config.user_agent = NULL;
}
}
+
+ const ucl_object_t *keepalive_interval;
+
+ keepalive_interval = ucl_object_lookup (client_obj, "keepalive_interval");
+
+ if (keepalive_interval) {
+ ctx->config.keepalive_interval = ucl_object_todouble (keepalive_interval);
+ }
}
server_obj = ucl_object_lookup (http_obj, "server");
event_set (&cbdata->ev, conn->fd, EV_READ|EV_TIMEOUT,
rspamd_http_keepalive_handler,
- &cbdata);
+ cbdata);
double_to_tv (timeout, &tv);
event_base_set (ev_base, &cbdata->ev);