diff options
author | Christian Beier <dontmind@freeshell.org> | 2010-11-18 14:04:23 +0100 |
---|---|---|
committer | Christian Beier <dontmind@freeshell.org> | 2010-11-18 15:00:34 +0100 |
commit | 079394ca5b14d8067b95a9cf95a834828b4425a6 (patch) | |
tree | 7b15cd03c1dea97d1380ae5ada70080a411b7905 /libvncserver | |
parent | 453645a6ea71e79951d95f9658f7a751e4a62338 (diff) | |
download | libtdevnc-079394ca5b14d8067b95a9cf95a834828b4425a6.tar.gz libtdevnc-079394ca5b14d8067b95a9cf95a834828b4425a6.zip |
libvncserver sockets: favor per-screen maxclientwait over global one when set.
Signed-off-by: Christian Beier <dontmind@freeshell.org>
Diffstat (limited to 'libvncserver')
-rwxr-xr-x | libvncserver/sockets.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c index 01f5642..7840da0 100755 --- a/libvncserver/sockets.c +++ b/libvncserver/sockets.c @@ -498,7 +498,11 @@ rfbReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout) int rfbReadExact(rfbClientPtr cl,char* buf,int len) { - return(rfbReadExactTimeout(cl,buf,len,rfbMaxClientWait)); + /* favor the per-screen value if set */ + if(cl->screen->maxClientWait) + return(rfbReadExactTimeout(cl,buf,len,cl->screen->maxClientWait)); + else + return(rfbReadExactTimeout(cl,buf,len,rfbMaxClientWait)); } /* @@ -517,6 +521,7 @@ rfbWriteExact(rfbClientPtr cl, fd_set fds; struct timeval tv; int totalTimeWaited = 0; + const int timeout = cl->screen->maxClientWait ? cl->screen->maxClientWait : rfbMaxClientWait; #undef DEBUG_WRITE_EXACT #ifdef DEBUG_WRITE_EXACT @@ -552,7 +557,7 @@ rfbWriteExact(rfbClientPtr cl, return n; } - /* Retry every 5 seconds until we exceed rfbMaxClientWait. We + /* Retry every 5 seconds until we exceed timeout. We need to do this because select doesn't necessarily return immediately when the other end has gone away */ @@ -570,7 +575,7 @@ rfbWriteExact(rfbClientPtr cl, } if (n == 0) { totalTimeWaited += 5000; - if (totalTimeWaited >= rfbMaxClientWait) { + if (totalTimeWaited >= timeout) { errno = ETIMEDOUT; UNLOCK(cl->outputMutex); return -1; |