Browse Source

janssonrpcc: do not set TCP_KEEPIDLE if not available in the OS

Daniel-Constantin Mierla 3 years ago
parent
commit
3da9060a44
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/modules/janssonrpcc/janssonrpc_connect.c

+ 4 - 0
src/modules/janssonrpcc/janssonrpc_connect.c

@@ -316,8 +316,12 @@ int set_keepalive(int fd, int keepalive, int cnt, int idle, int intvl) {
 	res = setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &idle, sizeof(idle));
 	assert(res == 0);
 
+#ifdef HAVE_TCP_KEEPIDLE
 	res = setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(idle));
 	assert(res == 0);
+#else
+	LM_INFO("TCP_KEEPIDLE option not available - ignoring\n");
+#endif
 
 	res = setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &intvl, sizeof(intvl));
 	assert(res == 0);