summaryrefslogtreecommitdiff
path: root/adapters
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-12-29 15:41:03 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-12-29 15:41:03 +0100
commit18c55a8f1e93aaa4df6c970333ad3d691e3438b0 (patch)
treea6482fb7cfd2494394865325d84d91de01a163da /adapters
parent8cb4d52cd273d6134f881c232a307c3259af334a (diff)
Scope event library related data and hooks to a struct
Diffstat (limited to 'adapters')
-rw-r--r--adapters/ae.h14
-rw-r--r--adapters/libev.h14
-rw-r--r--adapters/libevent.h14
3 files changed, 21 insertions, 21 deletions
diff --git a/adapters/ae.h b/adapters/ae.h
index b8b2228..85260a7 100644
--- a/adapters/ae.h
+++ b/adapters/ae.h
@@ -72,7 +72,7 @@ int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) {
redisAeEvents *e;
/* Nothing should be attached when something is already attached */
- if (ac->_adapter_data != NULL)
+ if (ac->ev.data != NULL)
return REDIS_ERR;
/* Create container for context and r/w events */
@@ -83,12 +83,12 @@ int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) {
e->reading = e->writing = 0;
/* Register functions to start/stop listening for events */
- ac->evAddRead = redisAeAddRead;
- ac->evDelRead = redisAeDelRead;
- ac->evAddWrite = redisAeAddWrite;
- ac->evDelWrite = redisAeDelWrite;
- ac->evCleanup = redisAeCleanup;
- ac->_adapter_data = e;
+ ac->ev.addRead = redisAeAddRead;
+ ac->ev.delRead = redisAeDelRead;
+ ac->ev.addWrite = redisAeAddWrite;
+ ac->ev.delWrite = redisAeDelWrite;
+ ac->ev.cleanup = redisAeCleanup;
+ ac->ev.data = e;
return REDIS_OK;
}
diff --git a/adapters/libev.h b/adapters/libev.h
index 3b9ed65..7b2b6af 100644
--- a/adapters/libev.h
+++ b/adapters/libev.h
@@ -82,7 +82,7 @@ int redisLibevAttach(EV_P_ redisAsyncContext *ac) {
redisLibevEvents *e;
/* Nothing should be attached when something is already attached */
- if (ac->_adapter_data != NULL)
+ if (ac->ev.data != NULL)
return REDIS_ERR;
/* Create container for context and r/w events */
@@ -98,12 +98,12 @@ int redisLibevAttach(EV_P_ redisAsyncContext *ac) {
e->wev.data = e;
/* Register functions to start/stop listening for events */
- ac->evAddRead = redisLibevAddRead;
- ac->evDelRead = redisLibevDelRead;
- ac->evAddWrite = redisLibevAddWrite;
- ac->evDelWrite = redisLibevDelWrite;
- ac->evCleanup = redisLibevCleanup;
- ac->_adapter_data = e;
+ ac->ev.addRead = redisLibevAddRead;
+ ac->ev.delRead = redisLibevDelRead;
+ ac->ev.addWrite = redisLibevAddWrite;
+ ac->ev.delWrite = redisLibevDelWrite;
+ ac->ev.cleanup = redisLibevCleanup;
+ ac->ev.data = e;
/* Initialize read/write events */
ev_io_init(&e->rev,redisLibevReadEvent,c->fd,EV_READ);
diff --git a/adapters/libevent.h b/adapters/libevent.h
index dc1f5c7..2cc2823 100644
--- a/adapters/libevent.h
+++ b/adapters/libevent.h
@@ -52,7 +52,7 @@ int redisLibeventAttach(redisAsyncContext *ac, struct event_base *base) {
redisLibeventEvents *e;
/* Nothing should be attached when something is already attached */
- if (ac->_adapter_data != NULL)
+ if (ac->ev.data != NULL)
return REDIS_ERR;
/* Create container for context and r/w events */
@@ -60,12 +60,12 @@ int redisLibeventAttach(redisAsyncContext *ac, struct event_base *base) {
e->context = ac;
/* Register functions to start/stop listening for events */
- ac->evAddRead = redisLibeventAddRead;
- ac->evDelRead = redisLibeventDelRead;
- ac->evAddWrite = redisLibeventAddWrite;
- ac->evDelWrite = redisLibeventDelWrite;
- ac->evCleanup = redisLibeventCleanup;
- ac->_adapter_data = e;
+ ac->ev.addRead = redisLibeventAddRead;
+ ac->ev.delRead = redisLibeventDelRead;
+ ac->ev.addWrite = redisLibeventAddWrite;
+ ac->ev.delWrite = redisLibeventDelWrite;
+ ac->ev.cleanup = redisLibeventCleanup;
+ ac->ev.data = e;
/* Initialize and install read/write events */
event_set(&e->rev,c->fd,EV_READ,redisLibeventReadEvent,e);