diff options
Diffstat (limited to 'example-libev.c')
-rw-r--r-- | example-libev.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/example-libev.c b/example-libev.c index ecf8c02..8efa1e3 100644 --- a/example-libev.c +++ b/example-libev.c @@ -15,10 +15,16 @@ void getCallback(redisAsyncContext *c, void *r, void *privdata) { redisAsyncDisconnect(c); } +void connectCallback(const redisAsyncContext *c) { + ((void)c); + printf("connected...\n"); +} + void disconnectCallback(const redisAsyncContext *c, int status) { if (status != REDIS_OK) { printf("Error: %s\n", c->errstr); } + printf("disconnected...\n"); } int main (int argc, char **argv) { @@ -32,6 +38,7 @@ int main (int argc, char **argv) { } redisLibevAttach(EV_DEFAULT_ c); + redisAsyncSetConnectCallback(c,connectCallback); redisAsyncSetDisconnectCallback(c,disconnectCallback); redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1])); redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key"); |