diff options
author | Pierre Ossman <ossman@cendio.se> | 2016-04-29 13:37:55 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2016-04-29 13:37:55 +0200 |
commit | 3b46a398b1dcaad78aaf237bc3e6c200de452650 (patch) | |
tree | 675fb2918e652a4476be2d5140aa1b812ae046ca /common | |
parent | 75bbf640a4240e57406ae171473d26dde2636389 (diff) | |
download | tigervnc-3b46a398b1dcaad78aaf237bc3e6c200de452650.tar.gz tigervnc-3b46a398b1dcaad78aaf237bc3e6c200de452650.zip |
Remove Windows 98 socket workaround
We haven't supported such an old version of Windows for some time.
Diffstat (limited to 'common')
-rw-r--r-- | common/rdr/FdOutStream.cxx | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/common/rdr/FdOutStream.cxx b/common/rdr/FdOutStream.cxx index f4299030..520853ff 100644 --- a/common/rdr/FdOutStream.cxx +++ b/common/rdr/FdOutStream.cxx @@ -183,38 +183,34 @@ int FdOutStream::writeWithTimeout(const void* data, int length, int timeoutms) int n; do { + fd_set fds; + struct timeval tv; + struct timeval* tvp = &tv; - do { - fd_set fds; - struct timeval tv; - struct timeval* tvp = &tv; - - if (timeoutms != -1) { - tv.tv_sec = timeoutms / 1000; - tv.tv_usec = (timeoutms % 1000) * 1000; - } else { - tvp = 0; - } + if (timeoutms != -1) { + tv.tv_sec = timeoutms / 1000; + tv.tv_usec = (timeoutms % 1000) * 1000; + } else { + tvp = NULL; + } - FD_ZERO(&fds); - FD_SET(fd, &fds); - n = select(fd+1, 0, &fds, 0, tvp); - } while (n < 0 && errno == EINTR); + FD_ZERO(&fds); + FD_SET(fd, &fds); + n = select(fd+1, 0, &fds, 0, tvp); + } while (n < 0 && errno == EINTR); - if (n < 0) throw SystemException("select",errno); + if (n < 0) + throw SystemException("select", errno); - if (n == 0) return 0; + if (n == 0) + return 0; - do { - n = ::write(fd, data, length); - } while (n < 0 && (errno == EINTR)); - - // NB: This outer loop simply fixes a broken Winsock2 EWOULDBLOCK - // condition, found only under Win98 (first edition), with slow - // network connections. Should in fact never ever happen... - } while (n < 0 && (errno == EWOULDBLOCK)); + do { + n = ::write(fd, data, length); + } while (n < 0 && (errno == EINTR)); - if (n < 0) throw SystemException("write",errno); + if (n < 0) + throw SystemException("write", errno); gettimeofday(&lastWrite, NULL); |