summaryrefslogtreecommitdiffstats
path: root/libvncserver/main.c
diff options
context:
space:
mode:
authorsteven_carr <steven_carr>2006-05-15 05:37:39 +0000
committersteven_carr <steven_carr>2006-05-15 05:37:39 +0000
commitccdbe8f3256c3c776a1cc1a0517a38437b9e2c65 (patch)
tree9853559d1c965946b196cccd03ce0f466d524950 /libvncserver/main.c
parent347c4a98475d1dba8030efe33aa0b35856c4d17f (diff)
downloadlibtdevnc-ccdbe8f3256c3c776a1cc1a0517a38437b9e2c65.tar.gz
libtdevnc-ccdbe8f3256c3c776a1cc1a0517a38437b9e2c65.zip
The great UltraVNC Compatibility Commit
Diffstat (limited to 'libvncserver/main.c')
-rw-r--r--libvncserver/main.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/libvncserver/main.c b/libvncserver/main.c
index 6a34980..cded456 100644
--- a/libvncserver/main.c
+++ b/libvncserver/main.c
@@ -495,22 +495,40 @@ clientInput(void *data)
pthread_create(&output_thread, NULL, clientOutput, (void *)cl);
while (1) {
- fd_set fds;
+ fd_set rfds, wfds, efds;
struct timeval tv;
int n;
- FD_ZERO(&fds);
- FD_SET(cl->sock, &fds);
+ FD_ZERO(&rfds);
+ FD_SET(cl->sock, &rfds);
+ FD_ZERO(&efds);
+ FD_SET(cl->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);
+
tv.tv_sec = 60; /* 1 minute */
tv.tv_usec = 0;
- n = select(cl->sock + 1, &fds, NULL, &fds, &tv);
+ n = select(cl->sock + 1, &rfds, &wfds, &efds, &tv);
if (n < 0) {
rfbLogPerror("ReadExact: select");
break;
}
if (n == 0) /* timeout */
+ {
+ rfbSendFileTransferChunk(cl);
continue;
- rfbProcessClientMessage(cl);
+ }
+
+ /* We have some space on the transmit queue, send some data */
+ if (FD_ISSET(cl->sock, &wfds))
+ rfbSendFileTransferChunk(cl);
+
+ if (FD_ISSET(cl->sock, &rfds) || FD_ISSET(cl->sock, &efds))
+ rfbProcessClientMessage(cl);
+
if (cl->sock == -1) {
/* Client has disconnected. */
break;
@@ -818,6 +836,10 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen->handleEventsEagerly = FALSE;
+ /* Emulate UltraVNC Server by default */
+ screen->protocolMajorVersion = 3;
+ screen->protocolMinorVersion = 6;
+
if(!rfbProcessArguments(screen,argc,argv)) {
free(screen);
return NULL;