summaryrefslogtreecommitdiff
path: root/src/ae_epoll.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-12-15 11:42:40 +0100
committerantirez <antirez@gmail.com>2011-12-15 11:42:40 +0100
commite074416be49947c7bab5e237fab7210441bd99e5 (patch)
treee126e02f9fca9f4ed38fe58d9d2e622257c46369 /src/ae_epoll.c
parent503d87a818ffd11c275bba6479bcd5b4a855e8ca (diff)
downloadredis-e074416be49947c7bab5e237fab7210441bd99e5.tar.gz
Max limit to 10k clients removed, this implements feature request on issue #194
Diffstat (limited to 'src/ae_epoll.c')
-rw-r--r--src/ae_epoll.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/ae_epoll.c b/src/ae_epoll.c
index 5680b6a27..fc6d9ccdd 100644
--- a/src/ae_epoll.c
+++ b/src/ae_epoll.c
@@ -6,15 +6,21 @@
typedef struct aeApiState {
int epfd;
- struct epoll_event events[AE_SETSIZE];
+ struct epoll_event *events;
} aeApiState;
static int aeApiCreate(aeEventLoop *eventLoop) {
aeApiState *state = zmalloc(sizeof(aeApiState));
if (!state) return -1;
+ state->events = zmalloc(sizeof(epoll_event)*eventLoop->setsize);
+ if (!state->events) {
+ zfree(state);
+ return -1;
+ }
state->epfd = epoll_create(1024); /* 1024 is just an hint for the kernel */
if (state->epfd == -1) {
+ zfree(state->events);
zfree(state);
return -1;
}
@@ -26,6 +32,7 @@ static void aeApiFree(aeEventLoop *eventLoop) {
aeApiState *state = eventLoop->apidata;
close(state->epfd);
+ zfree(state->events);
zfree(state);
}
@@ -70,7 +77,7 @@ static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
aeApiState *state = eventLoop->apidata;
int retval, numevents = 0;
- retval = epoll_wait(state->epfd,state->events,AE_SETSIZE,
+ retval = epoll_wait(state->epfd,state->events,eventLoop->setsize,
tvp ? (tvp->tv_sec*1000 + tvp->tv_usec/1000) : -1);
if (retval > 0) {
int j;