summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-01 14:12:53 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-01 14:13:03 +0100
commitef995accb2bccf0c1a6ec95dd4810c599b9138f8 (patch)
tree8a3d91777ce962911a01003fedcc09e45b1c470a
parent9323030527f71a33d19233875461b4ae2ae9ecd4 (diff)
Strip non-blocking callbacks from hiredis.c
-rw-r--r--hiredis.c29
-rw-r--r--hiredis.h28
2 files changed, 0 insertions, 57 deletions
diff --git a/hiredis.c b/hiredis.c
index ae2d7aa..ca4cd88 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -643,8 +643,6 @@ static redisContext *redisContextInit() {
}
void redisDisconnect(redisContext *c) {
- if (c->cbDisconnect.fn != NULL)
- c->cbDisconnect.fn(c,c->cbDisconnect.privdata);
close(c->fd);
c->flags &= ~REDIS_CONNECTED;
}
@@ -653,10 +651,6 @@ void redisFree(redisContext *c) {
/* Disconnect before free'ing if not yet disconnected. */
if (c->flags & REDIS_CONNECTED)
redisDisconnect(c);
-
- /* Fire free callback and clear all allocations. */
- if (c->cbFree.fn != NULL)
- c->cbFree.fn(c,c->cbFree.privdata);
if (c->error != NULL)
sdsfree(c->error);
if (c->obuf != NULL)
@@ -701,25 +695,6 @@ static void __redisCreateReplyReader(redisContext *c) {
c->reader = redisReplyReaderCreate(c->fn);
}
-/* Register callback that is triggered when redisDisconnect is called. */
-void redisSetDisconnectCallback(redisContext *c, redisContextCallbackFn *fn, void *privdata) {
- c->cbDisconnect.fn = fn;
- c->cbDisconnect.privdata = privdata;
-}
-
-/* Register callback that is triggered when a command is put in the output
- * buffer when the context is non-blocking. */
-void redisSetCommandCallback(redisContext *c, redisContextCallbackFn *fn, void *privdata) {
- c->cbCommand.fn = fn;
- c->cbCommand.privdata = privdata;
-}
-
-/* Register callback that is triggered when the context is free'd. */
-void redisSetFreeCallback(redisContext *c, redisContextCallbackFn *fn, void *privdata) {
- c->cbFree.fn = fn;
- c->cbFree.privdata = privdata;
-}
-
/* Use this function to handle a read event on the descriptor. It will try
* and read some bytes from the socket and feed them to the reply parser.
*
@@ -834,10 +809,6 @@ int redisGetReply(redisContext *c, void **reply) {
*/
void __redisAppendCommand(redisContext *c, char *cmd, size_t len) {
c->obuf = sdscatlen(c->obuf,cmd,len);
-
- /* Fire write callback */
- if (c->cbCommand.fn != NULL)
- c->cbCommand.fn(c,c->cbCommand.privdata);
}
void redisvAppendCommand(redisContext *c, const char *format, va_list ap) {
diff --git a/hiredis.h b/hiredis.h
index 76b07e0..d149c6f 100644
--- a/hiredis.h
+++ b/hiredis.h
@@ -84,15 +84,6 @@ typedef struct redisReplyObjectFunctions {
struct redisContext; /* need forward declaration of redisContext */
-/* Callbacks triggered on non-reply events. */
-typedef void (redisContextCallbackFn)(struct redisContext*, void*);
-
-/* Callback containers */
-typedef struct redisContextCallback {
- redisContextCallbackFn *fn;
- void *privdata;
-} redisContextCallback;
-
/* Context for a connection to Redis */
typedef struct redisContext {
int fd;
@@ -103,11 +94,6 @@ typedef struct redisContext {
/* Function set for reply buildup and reply reader */
redisReplyObjectFunctions *fn;
void *reader;
-
- /* Non-reply callbacks */
- redisContextCallback cbDisconnect;
- redisContextCallback cbCommand;
- redisContextCallback cbFree;
} redisContext;
void freeReplyObject(void *reply);
@@ -137,20 +123,6 @@ int redisBufferWrite(redisContext *c, int *done);
* context, it will return unconsumed replies until there are no more. */
int redisGetReply(redisContext *c, void **reply);
-/* The disconnect callback is called *immediately* when redisDisconnect()
- * is called. It is called only once for every redisContext (since hiredis
- * currently does not support reconnecting an existing context). */
-void redisSetDisconnectCallback(redisContext *c, redisContextCallbackFn *fn, void *privdata);
-
-/* The command callback is called every time redisCommand() is called in a
- * non-blocking context. It is called *after* the formatted command has been
- * appended to the write buffer. */
-void redisSetCommandCallback(redisContext *c, redisContextCallbackFn *fn, void *privdata);
-
-/* The free callback is called *before* all allocations are free'd. Use it to
- * release resources that depend/use the redisContext that is being free'd. */
-void redisSetFreeCallback(redisContext *c, redisContextCallbackFn *fn, void *privdata);
-
/* Write a command to the output buffer. Use these functions in blocking mode
* to get a pipeline of commands. */
void redisvAppendCommand(redisContext *c, const char *format, va_list ap);