[Live-devel] Non portable sockopt macros in latest
Wictor Lund
wlund at iki.fi
Fri Jan 24 12:36:06 PST 2020
Hi!
I just downloaded the latest version of live555 and noticed that it won't
compile on OpenBSD straight away. The issue is with the macros TCP_KEEPCNT
and TCP_KEEPINTVL in groupsock/GroupsockHelper.cpp. According to the man
page [1] these macro are Linux specific and not necessarily portable.
1. http://man7.org/linux/man-pages/man7/tcp.7.html
--
Wictor Lund
diff --git a/groupsock/GroupsockHelper.cpp b/groupsock/GroupsockHelper.cpp
old mode 100644
new mode 100755
index c40bf57..1ddf91f
--- a/groupsock/GroupsockHelper.cpp
+++ b/groupsock/GroupsockHelper.cpp
@@ -240,15 +240,19 @@ Boolean setSocketKeepAlive(int sock) {
}
#endif
+#ifdef TCP_KEEPCNT
int const keepalive_count = 5;
if (setsockopt(sock, IPPROTO_TCP, TCP_KEEPCNT, (void*)&keepalive_count, sizeof keepalive_count) < 0) {
return False;
}
+#endif
+#ifdef TCP_KEEPINTVL
int const keepalive_interval = 20;
if (setsockopt(sock, IPPROTO_TCP, TCP_KEEPINTVL, (void*)&keepalive_interval, sizeof keepalive_interval) < 0) {
return False;
}
+#endif
#endif
return True;
More information about the live-devel
mailing list