diff options
author | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-03-23 01:21:46 +0100 |
---|---|---|
committer | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2024-03-23 01:21:46 +0100 |
commit | bb3475e8eb379ee18f3d8f37caa8040b852a6213 (patch) | |
tree | 89975f1c23814a7ab5e16f5c7887f55f1888a27a /examples/example-libevent-ssl.c | |
parent | aee72918851db8af296e096b759dfb7aaea17968 (diff) |
all: rename redis -> redict symbols and commentsmaster
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'examples/example-libevent-ssl.c')
-rw-r--r-- | examples/example-libevent-ssl.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/examples/example-libevent-ssl.c b/examples/example-libevent-ssl.c index a142b22..b15e7e2 100644 --- a/examples/example-libevent-ssl.c +++ b/examples/example-libevent-ssl.c @@ -10,29 +10,29 @@ #include <signal.h> #include <hiredict.h> -#include <hiredis_ssl.h> +#include <hiredict_ssl.h> #include <async.h> #include <adapters/libevent.h> -void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; +void getCallback(redictAsyncContext *c, void *r, void *privdata) { + redictReply *reply = r; if (reply == NULL) return; printf("argv[%s]: %s\n", (char*)privdata, reply->str); /* Disconnect after receiving the reply to GET */ - redisAsyncDisconnect(c); + redictAsyncDisconnect(c); } -void connectCallback(const redisAsyncContext *c, int status) { - if (status != REDIS_OK) { +void connectCallback(const redictAsyncContext *c, int status) { + if (status != REDICT_OK) { printf("Error: %s\n", c->errstr); return; } printf("Connected...\n"); } -void disconnectCallback(const redisAsyncContext *c, int status) { - if (status != REDIS_OK) { +void disconnectCallback(const redictAsyncContext *c, int status) { + if (status != REDICT_OK) { printf("Error: %s\n", c->errstr); return; } @@ -61,36 +61,36 @@ int main (int argc, char **argv) { const char *certKey = argv[5]; const char *caCert = argc > 5 ? argv[6] : NULL; - redisSSLContext *ssl; - redisSSLContextError ssl_error = REDIS_SSL_CTX_NONE; + redictSSLContext *ssl; + redictSSLContextError ssl_error = REDICT_SSL_CTX_NONE; - redisInitOpenSSL(); + redictInitOpenSSL(); - ssl = redisCreateSSLContext(caCert, NULL, + ssl = redictCreateSSLContext(caCert, NULL, cert, certKey, NULL, &ssl_error); if (!ssl) { printf("Error: %s\n", redictSSLContextGetError(ssl_error)); return 1; } - redisAsyncContext *c = redisAsyncConnect(hostname, port); + redictAsyncContext *c = redictAsyncConnect(hostname, port); if (c->err) { /* Let *c leak for now... */ printf("Error: %s\n", c->errstr); return 1; } - if (redisInitiateSSLWithContext(&c->c, ssl) != REDIS_OK) { + if (redictInitiateSSLWithContext(&c->c, ssl) != REDICT_OK) { printf("SSL Error!\n"); exit(1); } - redisLibeventAttach(c,base); - redisAsyncSetConnectCallback(c,connectCallback); - redisAsyncSetDisconnectCallback(c,disconnectCallback); - redisAsyncCommand(c, NULL, NULL, "SET key %b", value, nvalue); - redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key"); + redictLibeventAttach(c,base); + redictAsyncSetConnectCallback(c,connectCallback); + redictAsyncSetDisconnectCallback(c,disconnectCallback); + redictAsyncCommand(c, NULL, NULL, "SET key %b", value, nvalue); + redictAsyncCommand(c, getCallback, (char*)"end-1", "GET key"); event_base_dispatch(base); - redisFreeSSLContext(ssl); + redictFreeSSLContext(ssl); return 0; } |