mirror of https://github.com/aria2/aria2
2010-04-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Increased _epEvents size if necessary. * src/EpollEventPoll.cc * src/EpollEventPoll.hpull/1/head
parent
1d652cd0ad
commit
ced238d098
|
@ -1,3 +1,9 @@
|
|||
2010-04-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Increased _epEvents size if necessary.
|
||||
* src/EpollEventPoll.cc
|
||||
* src/EpollEventPoll.h
|
||||
|
||||
2010-04-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Removed EventRType template parameter
|
||||
|
|
|
@ -77,11 +77,12 @@ struct epoll_event EpollEventPoll::KSocketEntry::getEvents()
|
|||
return epEvent;
|
||||
}
|
||||
|
||||
EpollEventPoll::EpollEventPoll():_logger(LogFactory::getInstance())
|
||||
EpollEventPoll::EpollEventPoll():
|
||||
_epEventsSize(EPOLL_EVENTS_MAX),
|
||||
_epEvents(new struct epoll_event[_epEventsSize]),
|
||||
_logger(LogFactory::getInstance())
|
||||
{
|
||||
_epfd = epoll_create(EPOLL_EVENTS_MAX);
|
||||
|
||||
_epEvents = new struct epoll_event[EPOLL_EVENTS_MAX];
|
||||
}
|
||||
|
||||
EpollEventPoll::~EpollEventPoll()
|
||||
|
@ -178,6 +179,11 @@ bool EpollEventPoll::addEvents(sock_t socket,
|
|||
}
|
||||
} else {
|
||||
_socketEntries.insert(i, socketEntry);
|
||||
if(_socketEntries.size() > _epEventsSize) {
|
||||
_epEventsSize *= 2;
|
||||
delete [] _epEvents;
|
||||
_epEvents = new struct epoll_event[_epEventsSize];
|
||||
}
|
||||
|
||||
event.addSelf(socketEntry);
|
||||
|
||||
|
|
|
@ -78,6 +78,8 @@ private:
|
|||
|
||||
int _epfd;
|
||||
|
||||
size_t _epEventsSize;
|
||||
|
||||
struct epoll_event* _epEvents;
|
||||
|
||||
static const size_t EPOLL_EVENTS_MAX = 1024;
|
||||
|
|
Loading…
Reference in New Issue