2008-06-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Made _epEvents a member variable.
	* src/DownloadEngine.cc
	* src/DownloadEngine.h
pull/1/head
Tatsuhiro Tsujikawa 2008-06-17 09:29:43 +00:00
parent d4b29c84fc
commit 09502fc3db
3 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2008-06-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Made _epEvents a member variable.
* src/DownloadEngine.cc
* src/DownloadEngine.h
2008-06-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Cancel download if http redirect is bounded more than 20 times.

View File

@ -398,6 +398,8 @@ DownloadEngine::DownloadEngine():logger(LogFactory::getInstance()),
_epfd = epoll_create(EPOLL_EVENTS_MAX);
_epEvents = new struct epoll_event[EPOLL_EVENTS_MAX];
#else // !HAVE_EPOLL
updateFdSet();
@ -419,6 +421,7 @@ DownloadEngine::~DownloadEngine() {
}
}
delete [] _epEvents;
#endif // HAVE_EPOLL
}
@ -496,12 +499,8 @@ void DownloadEngine::waitData()
// timeout is millisec
int timeout = _noWait ? 0 : 1000;
// TODO make member variable
const size_t _maxEpEvents = EPOLL_EVENTS_MAX;
struct epoll_event _epEvents[_maxEpEvents];
int res;
while((res = epoll_wait(_epfd, _epEvents, _maxEpEvents, timeout)) == -1 &&
while((res = epoll_wait(_epfd, _epEvents, EPOLL_EVENTS_MAX, timeout)) == -1 &&
errno == EINTR);
if(res > 0) {

View File

@ -237,6 +237,8 @@ private:
int _epfd;
struct epoll_event* _epEvents;
static const size_t EPOLL_EVENTS_MAX = 1024;
#else // !HAVE_EPOLL