pull/1060/merge
kwkam 2017-11-05 09:30:02 +00:00 committed by GitHub
commit aa10039148
1 changed files with 14 additions and 5 deletions

View File

@ -174,6 +174,18 @@ void SelectEventPoll::poll(const struct timeval& tv)
memcpy(&rfds, &rfdset_, sizeof(fd_set));
memcpy(&wfds, &wfdset_, sizeof(fd_set));
#ifdef __MINGW32__
fd_set efds;
FD_ZERO(&efds);
FD_SET(dummySocket_, &efds);
if (rfds.fd_count <= 0) {
FD_SET(dummySocket_, &rfds);
}
if (wfds.fd_count <= 0) {
FD_SET(dummySocket_, &wfds);
}
#endif // __MINGW32__
#ifdef ENABLE_ASYNC_DNS
for (auto& i : nameResolverEntries_) {
@ -190,11 +202,10 @@ void SelectEventPoll::poll(const struct timeval& tv)
do {
struct timeval ttv = tv;
#ifdef __MINGW32__
// TODO
// winsock will report non-blocking connect() errors in exceptfds, unlike
// posix, which will mark such sockets as writable.
// So just pass in our write socket set to exceptfds, too, to get connect()
// error notifications on Windows.
retval = select(fdmax_ + 1, &rfds, &wfds, &wfds, &ttv);
retval = select(fdmax_ + 1, &rfds, &wfds, &efds, &ttv);
#else // !__MINGW32__
retval = select(fdmax_ + 1, &rfds, &wfds, nullptr, &ttv);
#endif // !__MINGW32__
@ -243,8 +254,6 @@ void SelectEventPoll::updateFdSet()
FD_ZERO(&rfdset_);
FD_ZERO(&wfdset_);
#ifdef __MINGW32__
FD_SET(dummySocket_, &rfdset_);
FD_SET(dummySocket_, &wfdset_);
fdmax_ = dummySocket_;
#else // !__MINGW32__
fdmax_ = 0;