Module: kamailio
Branch: master
Commit: d32f8f52198d04a90f53a221a1797faa1a0f39af
URL:
https://github.com/kamailio/kamailio/commit/d32f8f52198d04a90f53a221a1797fa…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-05-16T13:48:28+02:00
core: tcp main - check setsockopt() result for SO_LINGER
---
Modified: src/core/tcp_main.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d32f8f52198d04a90f53a221a1797fa…
Patch:
https://github.com/kamailio/kamailio/commit/d32f8f52198d04a90f53a221a1797fa…
---
diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index b046d9a848..9edbe79a36 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -3199,8 +3199,7 @@ int tcp_init(struct socket_info* sock_info)
inline static void tcpconn_close_main_fd(struct tcp_connection* tcpconn)
{
int fd;
-
-
+
fd=tcpconn->s;
#ifdef USE_TLS
if (tcpconn->type==PROTO_TLS || tcpconn->type==PROTO_WSS)
@@ -3214,7 +3213,10 @@ inline static void tcpconn_close_main_fd(struct tcp_connection*
tcpconn)
.l_onoff = 1, /* non-zero value enables linger option in kernel */
.l_linger = 0, /* timeout interval in seconds */
};
- setsockopt(fd, SOL_SOCKET, SO_LINGER, &sl, sizeof(sl));
+ if(setsockopt(fd, SOL_SOCKET, SO_LINGER, &sl, sizeof(sl))<0) {
+ LM_WARN("setsockopt SO_LINGER %d - %s\n", errno,
+ strerror(errno));
+ }
}
if (unlikely(tcp_safe_close(fd)<0))
LM_ERR("(%p): %s close(%d) failed (flags 0x%x): %s (%d)\n", tcpconn,