Skip to content

Commit

Permalink
HiRedis update.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasff committed Dec 31, 2010
1 parent b56f788 commit f7309fa
Show file tree
Hide file tree
Showing 9 changed files with 335 additions and 88 deletions.
14 changes: 7 additions & 7 deletions hiredis/adapters/ae.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
}
Expand Down
14 changes: 7 additions & 7 deletions hiredis/adapters/libev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions hiredis/adapters/libevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@ 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 */
e = (redisLibeventEvents*)malloc(sizeof(*e));
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);
Expand Down
Loading

0 comments on commit f7309fa

Please sign in to comment.