Update examples

This commit is contained in:
Pieter Noordhuis 2011-06-27 23:55:25 +02:00
parent 3313bcd191
commit 0625e7c5fe
3 changed files with 24 additions and 13 deletions

View File

@ -18,17 +18,20 @@ void getCallback(redisAsyncContext *c, void *r, void *privdata) {
redisAsyncDisconnect(c); redisAsyncDisconnect(c);
} }
void connectCallback(const redisAsyncContext *c) { void connectCallback(const redisAsyncContext *c, int status) {
((void)c); if (status != REDIS_OK) {
printf("connected...\n"); printf("Error: %s\n", c->errstr);
return;
}
printf("Connected...\n");
} }
void disconnectCallback(const redisAsyncContext *c, int status) { void disconnectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) { if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr); printf("Error: %s\n", c->errstr);
return;
} }
printf("disconnected...\n"); printf("Disconnected...\n");
aeStop(loop);
} }
int main (int argc, char **argv) { int main (int argc, char **argv) {

View File

@ -15,16 +15,20 @@ void getCallback(redisAsyncContext *c, void *r, void *privdata) {
redisAsyncDisconnect(c); redisAsyncDisconnect(c);
} }
void connectCallback(const redisAsyncContext *c) { void connectCallback(const redisAsyncContext *c, int status) {
((void)c); if (status != REDIS_OK) {
printf("connected...\n"); printf("Error: %s\n", c->errstr);
return;
}
printf("Connected...\n");
} }
void disconnectCallback(const redisAsyncContext *c, int status) { void disconnectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) { if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr); printf("Error: %s\n", c->errstr);
return;
} }
printf("disconnected...\n"); printf("Disconnected...\n");
} }
int main (int argc, char **argv) { int main (int argc, char **argv) {

View File

@ -15,16 +15,20 @@ void getCallback(redisAsyncContext *c, void *r, void *privdata) {
redisAsyncDisconnect(c); redisAsyncDisconnect(c);
} }
void connectCallback(const redisAsyncContext *c) { void connectCallback(const redisAsyncContext *c, int status) {
((void)c); if (status != REDIS_OK) {
printf("connected...\n"); printf("Error: %s\n", c->errstr);
return;
}
printf("Connected...\n");
} }
void disconnectCallback(const redisAsyncContext *c, int status) { void disconnectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) { if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr); printf("Error: %s\n", c->errstr);
return;
} }
printf("disconnected...\n"); printf("Disconnected...\n");
} }
int main (int argc, char **argv) { int main (int argc, char **argv) {