summaryrefslogtreecommitdiff
path: root/data/libvncserver/clsockrace.diff
diff options
context:
space:
mode:
Diffstat (limited to 'data/libvncserver/clsockrace.diff')
-rw-r--r--data/libvncserver/clsockrace.diff48
1 files changed, 48 insertions, 0 deletions
diff --git a/data/libvncserver/clsockrace.diff b/data/libvncserver/clsockrace.diff
new file mode 100644
index 000000000..56b41e38e
--- /dev/null
+++ b/data/libvncserver/clsockrace.diff
@@ -0,0 +1,48 @@
+diff -ru LibVNCServer-0.9.8.1/libvncserver/main.c LibVNCServer-0.9.8.1+iPhone/libvncserver/main.c
+--- LibVNCServer-0.9.8.1/libvncserver/main.c 2011-10-12 16:52:18.000000000 +0000
++++ LibVNCServer-0.9.8.1+iPhone/libvncserver/main.c 2011-10-13 04:09:56.000000000 +0000
+@@ -517,24 +517,26 @@
+ struct timeval tv;
+ int n;
+
+- if (cl->sock == -1) {
++ int sock = cl->sock;
++
++ if (sock == -1) {
+ /* Client has disconnected. */
+ break;
+ }
+
+ FD_ZERO(&rfds);
+- FD_SET(cl->sock, &rfds);
++ FD_SET(sock, &rfds);
+ FD_ZERO(&efds);
+- FD_SET(cl->sock, &efds);
++ FD_SET(sock, &efds);
+
+ /* Are we transferring a file in the background? */
+ FD_ZERO(&wfds);
+ if ((cl->fileTransfer.fd!=-1) && (cl->fileTransfer.sending==1))
+- FD_SET(cl->sock, &wfds);
++ FD_SET(sock, &wfds);
+
+ tv.tv_sec = 60; /* 1 minute */
+ tv.tv_usec = 0;
+- n = select(cl->sock + 1, &rfds, &wfds, &efds, &tv);
++ n = select(sock + 1, &rfds, &wfds, &efds, &tv);
+ if (n < 0) {
+ rfbLogPerror("ReadExact: select");
+ break;
+@@ -546,10 +548,10 @@
+ }
+
+ /* We have some space on the transmit queue, send some data */
+- if (FD_ISSET(cl->sock, &wfds))
++ if (FD_ISSET(sock, &wfds))
+ rfbSendFileTransferChunk(cl);
+
+- if (FD_ISSET(cl->sock, &rfds) || FD_ISSET(cl->sock, &efds))
++ if (FD_ISSET(sock, &rfds) || FD_ISSET(cl->sock, &efds))
+ rfbProcessClientMessage(cl);
+ }
+