http_async_client: add parameters to enable/set tcp keepalive
[sip-router] / src / modules / http_async_client / async_http.c
index 87a62ea..9117778 100644 (file)
@@ -307,6 +307,9 @@ void notification_socket_cb(int fd, short event, void *arg)
        query_params.tls_verify_peer = aq->query_params.tls_verify_peer;
        query_params.tls_verify_host = aq->query_params.tls_verify_host;
        query_params.authmethod = aq->query_params.authmethod;
+       query_params.tcp_keepalive = aq->query_params.tcp_keepalive;
+       query_params.tcp_ka_idle = aq->query_params.tcp_ka_idle;
+       query_params.tcp_ka_interval = aq->query_params.tcp_ka_interval;
 
        for (i = 0 ; i < aq->query_params.headers.len ; i++) {
                query_params.headers = curl_slist_append(query_params.headers, aq->query_params.headers.t[i]);
@@ -495,6 +498,9 @@ int async_send_query(sip_msg_t *msg, str *query, str *cbname)
        aq->query_params.tls_verify_host = ah_params.tls_verify_host;
        aq->query_params.suspend_transaction = suspend;
        aq->query_params.timeout = ah_params.timeout;
+       aq->query_params.tcp_keepalive = ah_params.tcp_keepalive;
+       aq->query_params.tcp_ka_idle = ah_params.tcp_ka_idle;
+       aq->query_params.tcp_ka_interval = ah_params.tcp_ka_interval;
        aq->query_params.headers = ah_params.headers;
        aq->query_params.method = ah_params.method;
        aq->query_params.authmethod = ah_params.authmethod;
@@ -641,6 +647,9 @@ void set_query_params(struct query_params *p) {
        p->timeout = http_timeout;
        p->method = AH_METH_DEFAULT;
        p->authmethod = default_authmethod;
+       p->tcp_keepalive = tcp_keepalive;
+       p->tcp_ka_idle = tcp_ka_idle;
+       p->tcp_ka_interval = tcp_ka_interval;
 
        if (p->tls_client_cert) {
                shm_free(p->tls_client_cert);