1
0
xorg-x11-server/N-VNC-Readd-timeout-when-vnc-viewer-connection-breaks.patch

75 lines
1.9 KiB
Diff
Raw Normal View History

From: Egbert Eich <eich@freedesktop.org>
Date: Tue, 6 Sep 2011 07:02:11 +0200
Subject: [PATCH 2/6] VNC: Readd timeout when vnc viewer connection breaks.
Patch-Mainline: Currently no upstream project.
Git-commit: 759b49ed1c4ea03e45433c92c2fb8c44a60db34a
Signed-off: Egbert Eich <eich@suse.de>
References: bnc #441935, bnc #403901
This prevents Xvnc busy loop forever waiting for a viewer that no longer
response due to network or other issues.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
---
hw/vnc/sockets.c | 19 +++++--------------
1 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/hw/vnc/sockets.c b/hw/vnc/sockets.c
index 39eb88a..ae43ed0 100644
--- a/hw/vnc/sockets.c
+++ b/hw/vnc/sockets.c
@@ -442,9 +442,7 @@ WriteExact(int sock, char *buf, int len)
int n;
fd_set fds;
struct timeval tv;
-#if 0
int totalTimeWaited = 0;
-#endif
while (len > 0) {
n = write(sock, buf, len);
@@ -464,7 +462,6 @@ WriteExact(int sock, char *buf, int len)
return n;
}
-#if 0
/* Retry every 5 seconds until we exceed rfbMaxClientWait. We
need to do this because select doesn't necessarily return
immediately when the other end has gone away */
@@ -473,19 +470,14 @@ WriteExact(int sock, char *buf, int len)
FD_SET(sock, &fds);
tv.tv_sec = 5;
tv.tv_usec = 0;
-#else
- /* We're in the WakeupHandler now, so don't wait */
- FD_ZERO(&fds);
- FD_SET(sock, &fds);
- tv.tv_sec = 0;
- tv.tv_usec = 0;
-#endif
n = select(sock+1, NULL, &fds, NULL, &tv);
-#if 0
+
if (n < 0) {
- rfbLogPerror("WriteExact: select");
- return n;
+ if (errno != EINTR) {
+ rfbLogPerror("WriteExact: select");
+ return n;
+ }
}
if (n == 0) {
totalTimeWaited += 5000;
@@ -496,7 +488,6 @@ WriteExact(int sock, char *buf, int len)
} else {
totalTimeWaited = 0;
}
-#endif
}
}
return 1;
--
1.7.3.4