summaryrefslogtreecommitdiff
path: root/hiredis.h
diff options
context:
space:
mode:
Diffstat (limited to 'hiredis.h')
-rw-r--r--hiredis.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/hiredis.h b/hiredis.h
index 4025869..3e138cb 100644
--- a/hiredis.h
+++ b/hiredis.h
@@ -133,6 +133,9 @@ struct redisSsl;
*/
#define REDIS_OPT_NOAUTOFREE 0x04
+typedef int redisFD;
+#define REDIS_INVALID_FD -1
+
typedef struct {
/*
* the type of connection to use. This also indicates which
@@ -155,7 +158,7 @@ typedef struct {
/**
* use this field to have hiredis operate an already-open
* file descriptor */
- int fd;
+ redisFD fd;
} endpoint;
} redisOptions;
@@ -175,7 +178,7 @@ typedef struct {
typedef struct redisContext {
int err; /* Error flags, 0 when there is no error */
char errstr[128]; /* String representation of error when applicable */
- int fd;
+ redisFD fd;
int flags;
char *obuf; /* Write buffer */
redisReader *reader; /* Protocol reader */
@@ -212,7 +215,7 @@ redisContext *redisConnectBindNonBlockWithReuse(const char *ip, int port,
redisContext *redisConnectUnix(const char *path);
redisContext *redisConnectUnixWithTimeout(const char *path, const struct timeval tv);
redisContext *redisConnectUnixNonBlock(const char *path);
-redisContext *redisConnectFd(int fd);
+redisContext *redisConnectFd(redisFD fd);
/**
* Secure the connection using SSL. This should be done before any command is
@@ -235,7 +238,7 @@ int redisReconnect(redisContext *c);
int redisSetTimeout(redisContext *c, const struct timeval tv);
int redisEnableKeepAlive(redisContext *c);
void redisFree(redisContext *c);
-int redisFreeKeepFd(redisContext *c);
+redisFD redisFreeKeepFd(redisContext *c);
int redisBufferRead(redisContext *c);
int redisBufferWrite(redisContext *c, int *done);