mirror of https://github.com/aria2/aria2
2010-02-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Call ares_process_fd() each time after epoll to handle timeout. * src/EpollEventPoll.cc * src/EpollEventPoll.hpull/1/head
parent
ace04f4c80
commit
3f7df00d98
|
@ -1,3 +1,9 @@
|
||||||
|
2010-02-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Call ares_process_fd() each time after epoll to handle timeout.
|
||||||
|
* src/EpollEventPoll.cc
|
||||||
|
* src/EpollEventPoll.h
|
||||||
|
|
||||||
2010-01-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-01-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Suppressed type-cast compiler warning
|
Suppressed type-cast compiler warning
|
||||||
|
|
|
@ -292,6 +292,11 @@ void EpollEventPoll::AsyncNameResolverEntry::removeSocketEvents
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EpollEventPoll::AsyncNameResolverEntry::processTimeout()
|
||||||
|
{
|
||||||
|
_nameResolver->process(ARES_SOCKET_BAD, ARES_SOCKET_BAD);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // ENABLE_ASYNC_DNS
|
#endif // ENABLE_ASYNC_DNS
|
||||||
|
|
||||||
EpollEventPoll::EpollEventPoll():_logger(LogFactory::getInstance())
|
EpollEventPoll::EpollEventPoll():_logger(LogFactory::getInstance())
|
||||||
|
@ -336,6 +341,19 @@ void EpollEventPoll::poll(const struct timeval& tv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_ASYNC_DNS
|
||||||
|
// It turns out that we have to call ares_process_fd before ares's
|
||||||
|
// own timeout and ares may create new sockets or closes socket in
|
||||||
|
// their API. So we call ares_process_fd for all ares_channel and
|
||||||
|
// re-register their sockets.
|
||||||
|
for(std::deque<SharedHandle<AsyncNameResolverEntry> >::iterator i =
|
||||||
|
_nameResolverEntries.begin(); i != _nameResolverEntries.end(); ++i) {
|
||||||
|
(*i)->processTimeout();
|
||||||
|
(*i)->removeSocketEvents(this);
|
||||||
|
(*i)->addSocketEvents(this);
|
||||||
|
}
|
||||||
|
#endif // ENABLE_ASYNC_DNS
|
||||||
|
|
||||||
// TODO timeout of name resolver is determined in Command(AbstractCommand,
|
// TODO timeout of name resolver is determined in Command(AbstractCommand,
|
||||||
// DHTEntryPoint...Command)
|
// DHTEntryPoint...Command)
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,6 +216,10 @@ private:
|
||||||
void addSocketEvents(EpollEventPoll* socketPoll);
|
void addSocketEvents(EpollEventPoll* socketPoll);
|
||||||
|
|
||||||
void removeSocketEvents(EpollEventPoll* socketPoll);
|
void removeSocketEvents(EpollEventPoll* socketPoll);
|
||||||
|
|
||||||
|
// Calls AsyncNameResolver::process(ARES_SOCKET_BAD,
|
||||||
|
// ARES_SOCKET_BAD).
|
||||||
|
void processTimeout();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ENABLE_ASYNC_DNS
|
#endif // ENABLE_ASYNC_DNS
|
||||||
|
|
Loading…
Reference in New Issue