aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/krdc/files/patch-vnc__vncclientthread.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/net/krdc/files/patch-vnc__vncclientthread.cpp b/net/krdc/files/patch-vnc__vncclientthread.cpp
new file mode 100644
index 000000000000..55f3adfe12b8
--- /dev/null
+++ b/net/krdc/files/patch-vnc__vncclientthread.cpp
@@ -0,0 +1,40 @@
+Only use TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT if they exist.
+
+These options are present only in FreeBSD 9+, so we need this patch to maintain
+compatibility with FreeBSD 8.
+
+Not worth upstreaming, as OS X, Linux, NetBSD, OpenBSD and DragonFlyBSD have
+had these options for much longer than us.
+--- vnc/vncclientthread.cpp
++++ vnc/vncclientthread.cpp
+@@ -606,23 +606,30 @@ void VncClientThread::clientSetKeepalive()
+ return;
+ }
+
++#ifdef TCP_KEEPIDLE
+ optval = m_keepalive.intervalSeconds;
+ if (setsockopt(cl->sock, IPPROTO_TCP, TCP_KEEPIDLE, &optval, optlen) < 0) {
+ kError(5011) << "setsockopt(TCP_KEEPIDLE)" << strerror(errno);
+ return;
+ }
++#endif
+
++#ifdef TCP_KEEPINTVL
+ optval = m_keepalive.intervalSeconds;
+ if (setsockopt(cl->sock, IPPROTO_TCP, TCP_KEEPINTVL, &optval, optlen) < 0) {
+ kError(5011) << "setsockopt(TCP_KEEPINTVL)" << strerror(errno);
+ return;
+ }
++#endif
+
++#ifdef TCP_KEEPCNT
+ optval = m_keepalive.failedProbes;
+ if(setsockopt(cl->sock, IPPROTO_TCP, TCP_KEEPCNT, &optval, optlen) < 0) {
+ kError(5011) << "setsockopt(TCP_KEEPCNT)" << strerror(errno);
+ return;
+ }
++#endif
++
+ m_keepalive.set = true;
+ kDebug(5011) << "TCP keepalive set";
+ }