You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows, select() will not mark a writefd socket if a connect()ion fails, e.g. because the peer refused the connection, but instead mark an exceptfd.
If a socket is processing a connect call (nonblocking), failure of the connect attempt is indicated in exceptfds (application must then call getsockopt SO_ERROR to determine the error value to describe why the failure occurred).
aria2 does not check exceptfds (at all), leading aria2 to missing that error and only canceling the download once the regular timeout expires but not immediately after the connection actually broke.
On *nix, connect()ion failures are indicated by marking the writefd instead, so there it works.
This actually makes it work, but no idea what else it broke. It just uses the same writefd set as exceptfds as well.
--- a/src/SelectEventPoll.cc+++ b/src/SelectEventPoll.cc@@ -167,42 +167,37 @@ SelectEventPoll::~SelectEventPoll()
#endif // __MINGW32__
}
void SelectEventPoll::poll(const struct timeval& tv)
{
fd_set rfds;
fd_set wfds;
memcpy(&rfds, &rfdset_, sizeof(fd_set));
memcpy(&wfds, &wfdset_, sizeof(fd_set));
-#ifdef __MINGW32__- fd_set efds;- FD_ZERO(&efds);- FD_SET(dummySocket_, &efds);-#endif // __MINGW32__
#ifdef ENABLE_ASYNC_DNS
for (auto& i : nameResolverEntries_) {
auto& entry = i.second;
int fd = entry.getFds(&rfds, &wfds);
// TODO force error if fd == 0
if (fdmax_ < fd) {
fdmax_ = fd;
}
}
#endif // ENABLE_ASYNC_DNS
int retval;
do {
struct timeval ttv = tv;
#ifdef __MINGW32__
- retval = select(fdmax_ + 1, &rfds, &wfds, &efds, &ttv);+ retval = select(fdmax_ + 1, &rfds, &wfds, &wfds, &ttv);
#else // !__MINGW32__
retval = select(fdmax_ + 1, &rfds, &wfds, nullptr, &ttv);
#endif // !__MINGW32__
} while (retval == -1 && errno == EINTR);
if (retval > 0) {
for (auto& i : socketEntries_) {
auto& e = i.second;
int events = 0;
if (FD_ISSET(e.getSocket(), &rfds)) {
events |= EventPoll::EVENT_READ;
The text was updated successfully, but these errors were encountered:
On Windows,
select()
will not mark a writefd socket if a connect()ion fails, e.g. because the peer refused the connection, but instead mark an exceptfd.This is documented behavior:
aria2 does not check exceptfds (at all), leading aria2 to missing that error and only canceling the download once the regular timeout expires but not immediately after the connection actually broke.
On *nix, connect()ion failures are indicated by marking the writefd instead, so there it works.
This actually makes it work, but no idea what else it broke. It just uses the same writefd set as exceptfds as well.
The text was updated successfully, but these errors were encountered: