equal
deleted
inserted
replaced
621 int revents = 0; |
621 int revents = 0; |
622 struct timeval t; |
622 struct timeval t; |
623 fd_set rd, wr, ex; |
623 fd_set rd, wr, ex; |
624 jint fd = fdval(env, fdo); |
624 jint fd = fdval(env, fdo); |
625 |
625 |
626 t.tv_sec = (long)(timeout / 1000); |
|
627 t.tv_usec = (timeout % 1000) * 1000; |
|
628 |
|
629 FD_ZERO(&rd); |
626 FD_ZERO(&rd); |
630 FD_ZERO(&wr); |
627 FD_ZERO(&wr); |
631 FD_ZERO(&ex); |
628 FD_ZERO(&ex); |
632 if (events & POLLIN) { |
629 if (events & POLLIN) { |
633 FD_SET(fd, &rd); |
630 FD_SET(fd, &rd); |
636 events & POLLCONN) { |
633 events & POLLCONN) { |
637 FD_SET(fd, &wr); |
634 FD_SET(fd, &wr); |
638 } |
635 } |
639 FD_SET(fd, &ex); |
636 FD_SET(fd, &ex); |
640 |
637 |
641 rv = select(fd+1, &rd, &wr, &ex, &t); |
638 if (timeout >= 0) { |
|
639 t.tv_sec = (long)(timeout / 1000); |
|
640 t.tv_usec = (timeout % 1000) * 1000; |
|
641 } |
|
642 |
|
643 rv = select(fd+1, &rd, &wr, &ex, (timeout >= 0) ? &t : NULL); |
642 |
644 |
643 /* save last winsock error */ |
645 /* save last winsock error */ |
644 if (rv == SOCKET_ERROR) { |
646 if (rv == SOCKET_ERROR) { |
645 handleSocketError(env, WSAGetLastError()); |
647 handleSocketError(env, WSAGetLastError()); |
646 return IOS_THROWN; |
648 return IOS_THROWN; |