Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/async-ae.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {

void connectCallback(valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
aeStop(loop);
return;
}
Expand All @@ -33,7 +33,7 @@ void connectCallback(valkeyAsyncContext *c, int status) {

void disconnectCallback(const valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
aeStop(loop);
return;
}
Expand All @@ -46,9 +46,9 @@ int main(int argc, char **argv) {
signal(SIGPIPE, SIG_IGN);

valkeyAsyncContext *c = valkeyAsyncConnect("127.0.0.1", 6379);
if (c->err) {
if (valkeyAsyncGetError(c)) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return 1;
}

Expand Down
8 changes: 4 additions & 4 deletions examples/async-glib.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static void
connect_cb(valkeyAsyncContext *ac G_GNUC_UNUSED,
int status) {
if (status != VALKEY_OK) {
g_printerr("Failed to connect: %s\n", ac->errstr);
g_printerr("Failed to connect: %s\n", valkeyAsyncGetErrorString(ac));
g_main_loop_quit(mainloop);
} else {
g_printerr("Connected...\n");
Expand All @@ -22,7 +22,7 @@ static void
disconnect_cb(const valkeyAsyncContext *ac G_GNUC_UNUSED,
int status) {
if (status != VALKEY_OK) {
g_error("Failed to disconnect: %s", ac->errstr);
g_error("Failed to disconnect: %s", valkeyAsyncGetErrorString(ac));
} else {
g_printerr("Disconnected...\n");
g_main_loop_quit(mainloop);
Expand All @@ -48,8 +48,8 @@ gint main(gint argc G_GNUC_UNUSED, gchar *argv[] G_GNUC_UNUSED) {
GSource *source;

ac = valkeyAsyncConnect("127.0.0.1", 6379);
if (ac->err) {
g_printerr("%s\n", ac->errstr);
if (valkeyAsyncGetError(ac)) {
g_printerr("%s\n", valkeyAsyncGetErrorString(ac));
exit(EXIT_FAILURE);
}

Expand Down
8 changes: 4 additions & 4 deletions examples/async-ivykis.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {

void connectCallback(valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Connected...\n");
}

void disconnectCallback(const valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Disconnected...\n");
Expand All @@ -42,9 +42,9 @@ int main(int argc, char **argv) {
iv_init();

valkeyAsyncContext *c = valkeyAsyncConnect("127.0.0.1", 6379);
if (c->err) {
if (valkeyAsyncGetError(c)) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return 1;
}

Expand Down
8 changes: 4 additions & 4 deletions examples/async-libev.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {

void connectCallback(valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Connected...\n");
}

void disconnectCallback(const valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Disconnected...\n");
Expand All @@ -40,9 +40,9 @@ int main(int argc, char **argv) {
#endif

valkeyAsyncContext *c = valkeyAsyncConnect("127.0.0.1", 6379);
if (c->err) {
if (valkeyAsyncGetError(c)) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return 1;
}

Expand Down
8 changes: 4 additions & 4 deletions examples/async-libevent-tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {

void connectCallback(valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Connected...\n");
}

void disconnectCallback(const valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Disconnected...\n");
Expand Down Expand Up @@ -70,9 +70,9 @@ int main(int argc, char **argv) {
}

valkeyAsyncContext *c = valkeyAsyncConnect(hostname, port);
if (c->err) {
if (valkeyAsyncGetError(c)) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return 1;
}
if (valkeyInitiateTLSWithContext(&c->c, tls) != VALKEY_OK) {
Expand Down
12 changes: 6 additions & 6 deletions examples/async-libevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {
valkeyReply *reply = r;
if (reply == NULL) {
if (c->errstr) {
printf("errstr: %s\n", c->errstr);
if (valkeyAsyncGetErrorString(c)) {
printf("errstr: %s\n", valkeyAsyncGetErrorString(c));
}
return;
}
Expand All @@ -24,15 +24,15 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {

void connectCallback(valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Connected...\n");
}

void disconnectCallback(const valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Disconnected...\n");
Expand All @@ -51,9 +51,9 @@ int main(int argc, char **argv) {
options.connect_timeout = &tv;

valkeyAsyncContext *c = valkeyAsyncConnectWithOptions(&options);
if (c->err) {
if (valkeyAsyncGetError(c)) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return 1;
}

Expand Down
10 changes: 5 additions & 5 deletions examples/async-libhv.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void debugCallback(valkeyAsyncContext *c, void *r, void *privdata) {
valkeyReply *reply = r;

if (reply == NULL) {
printf("`DEBUG SLEEP` error: %s\n", c->errstr ? c->errstr : "unknown error");
printf("`DEBUG SLEEP` error: %s\n", valkeyAsyncGetErrorString(c) ? valkeyAsyncGetErrorString(c) : "unknown error");
return;
}

Expand All @@ -32,15 +32,15 @@ void debugCallback(valkeyAsyncContext *c, void *r, void *privdata) {

void connectCallback(valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Connected...\n");
}

void disconnectCallback(const valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Disconnected...\n");
Expand All @@ -52,9 +52,9 @@ int main(int argc, char **argv) {
#endif

valkeyAsyncContext *c = valkeyAsyncConnect("127.0.0.1", 6379);
if (c->err) {
if (valkeyAsyncGetError(c)) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return 1;
}

Expand Down
12 changes: 6 additions & 6 deletions examples/async-libsdevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void debugCallback(valkeyAsyncContext *c, void *r, void *privdata) {
valkeyReply *reply = r;
if (reply == NULL) {
/* The DEBUG SLEEP command will almost always fail, because we have set a 1 second timeout */
printf("`DEBUG SLEEP` error: %s\n", c->errstr ? c->errstr : "unknown error");
printf("`DEBUG SLEEP` error: %s\n", valkeyAsyncGetErrorString(c) ? valkeyAsyncGetErrorString(c) : "unknown error");
return;
}
/* Disconnect after receiving the reply of DEBUG SLEEP (which will not)*/
Expand All @@ -24,7 +24,7 @@ void debugCallback(valkeyAsyncContext *c, void *r, void *privdata) {
void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {
valkeyReply *reply = r;
if (reply == NULL) {
printf("`GET key` error: %s\n", c->errstr ? c->errstr : "unknown error");
printf("`GET key` error: %s\n", valkeyAsyncGetErrorString(c) ? valkeyAsyncGetErrorString(c) : "unknown error");
return;
}
printf("`GET key` result: argv[%s]: %s\n", (char *)privdata, reply->str);
Expand All @@ -35,15 +35,15 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {

void connectCallback(valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("connect error: %s\n", c->errstr);
printf("connect error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Connected...\n");
}

void disconnectCallback(const valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("disconnect because of error: %s\n", c->errstr);
printf("disconnect because of error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Disconnected...\n");
Expand All @@ -56,8 +56,8 @@ int main(int argc, char **argv) {
sd_event_default(&event);

valkeyAsyncContext *c = valkeyAsyncConnect("127.0.0.1", 6379);
if (c->err) {
printf("Error: %s\n", c->errstr);
if (valkeyAsyncGetError(c)) {
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
valkeyAsyncFree(c);
return 1;
}
Expand Down
12 changes: 6 additions & 6 deletions examples/async-libuv.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void debugCallback(valkeyAsyncContext *c, void *r, void *privdata) {
valkeyReply *reply = r;
if (reply == NULL) {
/* The DEBUG SLEEP command will almost always fail, because we have set a 1 second timeout */
printf("`DEBUG SLEEP` error: %s\n", c->errstr ? c->errstr : "unknown error");
printf("`DEBUG SLEEP` error: %s\n", valkeyAsyncGetErrorString(c) ? valkeyAsyncGetErrorString(c) : "unknown error");
return;
}
/* Disconnect after receiving the reply of DEBUG SLEEP (which will not)*/
Expand All @@ -24,7 +24,7 @@ void debugCallback(valkeyAsyncContext *c, void *r, void *privdata) {
void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {
valkeyReply *reply = r;
if (reply == NULL) {
printf("`GET key` error: %s\n", c->errstr ? c->errstr : "unknown error");
printf("`GET key` error: %s\n", valkeyAsyncGetErrorString(c) ? valkeyAsyncGetErrorString(c) : "unknown error");
return;
}
printf("`GET key` result: argv[%s]: %s\n", (char *)privdata, reply->str);
Expand All @@ -35,15 +35,15 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {

void connectCallback(valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("connect error: %s\n", c->errstr);
printf("connect error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Connected...\n");
}

void disconnectCallback(const valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("disconnect because of error: %s\n", c->errstr);
printf("disconnect because of error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Disconnected...\n");
Expand All @@ -57,9 +57,9 @@ int main(int argc, char **argv) {
uv_loop_t *loop = uv_default_loop();

valkeyAsyncContext *c = valkeyAsyncConnect("127.0.0.1", 6379);
if (c->err) {
if (valkeyAsyncGetError(c)) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return 1;
}

Expand Down
8 changes: 4 additions & 4 deletions examples/async-macosx.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {

void connectCallback(valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
printf("Connected...\n");
}

void disconnectCallback(const valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}
CFRunLoopStop(CFRunLoopGetCurrent());
Expand All @@ -75,9 +75,9 @@ int main(int argc, char **argv) {
}

valkeyAsyncContext *c = valkeyAsyncConnect("127.0.0.1", 6379);
if (c->err) {
if (valkeyAsyncGetError(c)) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return 1;
}

Expand Down
8 changes: 4 additions & 4 deletions examples/async-poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void getCallback(valkeyAsyncContext *c, void *r, void *privdata) {

void connectCallback(valkeyAsyncContext *c, int status) {
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
exit_loop = 1;
return;
}
Expand All @@ -34,7 +34,7 @@ void connectCallback(valkeyAsyncContext *c, int status) {
void disconnectCallback(const valkeyAsyncContext *c, int status) {
exit_loop = 1;
if (status != VALKEY_OK) {
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return;
}

Expand All @@ -45,9 +45,9 @@ int main(int argc, char **argv) {
signal(SIGPIPE, SIG_IGN);

valkeyAsyncContext *c = valkeyAsyncConnect("127.0.0.1", 6379);
if (c->err) {
if (valkeyAsyncGetError(c)) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
printf("Error: %s\n", valkeyAsyncGetErrorString(c));
return 1;
}

Expand Down
Loading