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);