Erratum: It is inherited - I had oberwritten the TCP_USER_TIMEOUT in handle_new_connect() with a missing TICKS_TO_S() - so it was a too high value (ticks instead of seconds).

Tried again in tcp_init() on the listening socket:

--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -3172,6 +3172,22 @@ int tcp_init(struct socket_info *sock_info)
        }
 #endif
        init_sock_keepalive(sock_info->socket);
+
+
+       if ((optval = TICKS_TO_S(cfg_get(tcp, tcp_cfg, send_timeout)))) {
+               optval *= 1000;
+               if(setsockopt(sock_info->socket, IPPROTO_TCP, TCP_USER_TIMEOUT, &optval,
+                                  sizeof(optval))
+                               < 0) {
+                       LM_WARN("failed to set TCP_USER_TIMEOUT: %s\n",
+                                       strerror(errno));
+               } else {
+                       LM_INFO("Set TCP_USER_TIMEOUT=%d ms\n", optval);
+               }
+       }
+
+
+
        if(bind(sock_info->socket, &addr->s, sockaddru_len(*addr)) == -1) {
                LM_ERR("bind(%x, %p, %d) on %s:%d : %s\n", sock_info->socket, &addr->s,
                                (unsigned)sockaddru_len(*addr), sock_info->address_str.s,

=> working, too.

What is your opinion? Should it be in tcp_init() or in handle_new_connect()?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/issues/3443/1654481936@github.com>