Browse code

http_async_client: add ifdef/endif block for tcp_keepalive

Federico Cabiddu authored on 09/02/2019 15:16:50
Showing 2 changed files
... ...
@@ -299,6 +299,11 @@ modparam("http_async_client", "tls_ca_path", "/etc/kamailio/ssl/ca/")
299 299
         <para>
300 300
 		    If defined to a non-zero value, TCP keepalive will be enabled on cURL connections.
301 301
 		</para>
302
+        <para>
303
+            <emphasis>
304
+            Requires libcurl >= 7.25.0
305
+            </emphasis>
306
+		</para>
302 307
 		<para>
303 308
 		<emphasis>
304 309
 			Default value is 0 (disabled).
... ...
@@ -529,6 +529,7 @@ int new_request(str *query, http_m_params_t *query_params, http_multi_cbe_t cb,
529 529
     
530 530
     /* enable tcp keepalives for the handler */
531 531
 	if (cell->params.tcp_keepalive) {
532
+#ifdef CURLOPT_TCP_KEEPALIVE
532 533
 		LM_DBG("Enabling TCP keepalives\n");
533 534
 		curl_easy_setopt(cell->easy, CURLOPT_TCP_KEEPALIVE, 1L);
534 535
 		
... ...
@@ -541,6 +542,9 @@ int new_request(str *query, http_m_params_t *query_params, http_multi_cbe_t cb,
541 541
 			curl_easy_setopt(cell->easy, CURLOPT_TCP_KEEPINTVL, cell->params.tcp_ka_interval);
542 542
 			LM_DBG("CURLOPT_TCP_KEEPINTERVAL set to %d\n", cell->params.tcp_ka_interval);
543 543
 		}
544
+#else
545
+		LM_DBG("tcp_keepalive configured, but installed cURL version doesn't include CURLOPT_TCP_KEEPINTERVAL.\n");
546
+#endif
544 547
 	}
545 548
 	
546 549
     LM_DBG("Adding easy %p to multi %p (%.*s)\n", cell->easy, g->multi, query->len, query->s);