[sr-dev] git:master:4a2f5334: http_async_client: add ifdef/endif block for tcp_keepalive
Federico Cabiddu
federico.cabiddu at gmail.com
Sat Feb 9 16:17:39 CET 2019
Module: kamailio
Branch: master
Commit: 4a2f5334e898b0c1aaffdd73cae205c9fee43f37
URL: https://github.com/kamailio/kamailio/commit/4a2f5334e898b0c1aaffdd73cae205c9fee43f37
Author: Federico Cabiddu <federico.cabiddu at gmail.com>
Committer: Federico Cabiddu <federico.cabiddu at gmail.com>
Date: 2019-02-09T16:16:50+01:00
http_async_client: add ifdef/endif block for tcp_keepalive
---
Modified: src/modules/http_async_client/doc/http_async_client_admin.xml
Modified: src/modules/http_async_client/http_multi.c
---
Diff: https://github.com/kamailio/kamailio/commit/4a2f5334e898b0c1aaffdd73cae205c9fee43f37.diff
Patch: https://github.com/kamailio/kamailio/commit/4a2f5334e898b0c1aaffdd73cae205c9fee43f37.patch
---
diff --git a/src/modules/http_async_client/doc/http_async_client_admin.xml b/src/modules/http_async_client/doc/http_async_client_admin.xml
index 73fdf32841..5a050bf424 100644
--- a/src/modules/http_async_client/doc/http_async_client_admin.xml
+++ b/src/modules/http_async_client/doc/http_async_client_admin.xml
@@ -299,6 +299,11 @@ modparam("http_async_client", "tls_ca_path", "/etc/kamailio/ssl/ca/")
<para>
If defined to a non-zero value, TCP keepalive will be enabled on cURL connections.
</para>
+ <para>
+ <emphasis>
+ Requires libcurl >= 7.25.0
+ </emphasis>
+ </para>
<para>
<emphasis>
Default value is 0 (disabled).
diff --git a/src/modules/http_async_client/http_multi.c b/src/modules/http_async_client/http_multi.c
index 43936a78de..948171b519 100644
--- a/src/modules/http_async_client/http_multi.c
+++ b/src/modules/http_async_client/http_multi.c
@@ -529,6 +529,7 @@ int new_request(str *query, http_m_params_t *query_params, http_multi_cbe_t cb,
/* enable tcp keepalives for the handler */
if (cell->params.tcp_keepalive) {
+#ifdef CURLOPT_TCP_KEEPALIVE
LM_DBG("Enabling TCP keepalives\n");
curl_easy_setopt(cell->easy, CURLOPT_TCP_KEEPALIVE, 1L);
@@ -541,6 +542,9 @@ int new_request(str *query, http_m_params_t *query_params, http_multi_cbe_t cb,
curl_easy_setopt(cell->easy, CURLOPT_TCP_KEEPINTVL, cell->params.tcp_ka_interval);
LM_DBG("CURLOPT_TCP_KEEPINTERVAL set to %d\n", cell->params.tcp_ka_interval);
}
+#else
+ LM_DBG("tcp_keepalive configured, but installed cURL version doesn't include CURLOPT_TCP_KEEPINTERVAL.\n");
+#endif
}
LM_DBG("Adding easy %p to multi %p (%.*s)\n", cell->easy, g->multi, query->len, query->s);
More information about the sr-dev
mailing list