Skip to content

Instantly share code, notes, and snippets.

@bmatheny
Created May 20, 2011 15:29
Show Gist options
  • Save bmatheny/983162 to your computer and use it in GitHub Desktop.
Save bmatheny/983162 to your computer and use it in GitHub Desktop.
hiredis weirdness
static void
redis_connect_cb(const struct redisAsyncContext *c) {
struct node *n = c->data;
if ( !n || c->err ) {
ERROR_OUT("Node is null or error is %s\n", c->errstr);
return;
} else if ( !(c->c.flags & REDIS_CONNECTED) ) {
DEBUG_OUT("Not connected\n");
return;
} else {
DEBUG_OUT("Successful connect to %s:%u %d\n", n->host, n->port, c->c.flags);
}
}
static void
redis_disconnect_cb(const struct redisAsyncContext *c, int status) {
if ( status == REDIS_OK ) {
DEBUG_OUT("Redis ok disconnect\n");
} else {
DEBUG_OUT("Redis disconnect error. %d: %s\n", c->err, c->errstr);
}
}
[debug] src/server.c:285:redis_connect_cb(): Successful connect to 127.0.0.1:6381 2
[debug] src/server.c:368:redis_disconnect_cb(): Redis disconnect error. 1: Connection refused
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment