2010-04-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Increased _epEvents size if necessary.
	* src/EpollEventPoll.cc
	* src/EpollEventPoll.h
pull/1/head
Tatsuhiro Tsujikawa 2010-04-20 13:54:23 +00:00
parent 1d652cd0ad
commit ced238d098
3 changed files with 17 additions and 3 deletions

View File

@ -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

View File

@ -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);

View File

@ -78,6 +78,8 @@ private:
int _epfd;
size_t _epEventsSize;
struct epoll_event* _epEvents;
static const size_t EPOLL_EVENTS_MAX = 1024;