Module: kamailio
Branch: master
Commit: 9105398413b4f9fab410482d9ebf5d82b6c3fb0a
URL: 
https://github.com/kamailio/kamailio/commit/9105398413b4f9fab410482d9ebf5d82b6c3fb0a

Author: Sergey Safarov <s.safa...@anycast-lb.net>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-06-06T16:08:44+02:00

core: tcp_send_timeout applied for outbound connections

---

Modified: src/core/tcp_main.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/9105398413b4f9fab410482d9ebf5d82b6c3fb0a.diff
Patch: 
https://github.com/kamailio/kamailio/commit/9105398413b4f9fab410482d9ebf5d82b6c3fb0a.patch

---

diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 604102dcef6..369bfb1f159 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -352,6 +352,17 @@ static int init_sock_opt(int s, int af)
                }
        }
 #endif
+#ifdef HAVE_TCP_USER_TIMEOUT
+       if((optval = TICKS_TO_S(cfg_get(tcp, tcp_cfg, send_timeout)))) {
+               optval *= 1000;
+               if(setsockopt(s, IPPROTO_TCP, TCP_USER_TIMEOUT, &optval, 
sizeof(optval))
+                               < 0) {
+                       LM_WARN("failed to set TCP_USER_TIMEOUT: %s\n", 
strerror(errno));
+               } else {
+                       LM_DBG("Set TCP_USER_TIMEOUT=%d ms\n", optval);
+               }
+       }
+#endif
 #ifdef HAVE_TCP_QUICKACK
        if(cfg_get(tcp, tcp_cfg, delayed_ack)) {
                optval = 0; /* reset quick ack => delayed ack */

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to