From 87a64cdefdd68c4f86f3fca5c654bc90d6a6a89e Mon Sep 17 00:00:00 2001 From: michael-grunder Date: Thu, 1 Sep 2022 20:33:10 -0700 Subject: [PATCH 1/3] Add REDIS_OPT_PREFER_UNSPEC See: #1099, #1096 --- README.md | 2 +- hiredis.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 661325cb2..e0f315c84 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ There are several flags you may set in the `redisOptions` struct to change defau | --- | --- | | REDIS\_OPT\_NONBLOCK | Tells hiredis to make a non-blocking connection. | | REDIS\_OPT\_REUSEADDR | Tells hiredis to set the [SO_REUSEADDR](https://man7.org/linux/man-pages/man7/socket.7.html) socket option | -| REDIS\_OPT\_PREFER\_IPV4
REDIS\_OPT\_PREFER_IPV6 | Informs hiredis to either prefer `IPV4` or `IPV6` when invoking [getaddrinfo](https://man7.org/linux/man-pages/man3/gai_strerror.3.html). Note that both of the options may be set at once, which will cause hiredis to spcify `AF_UNSPEC` in the getaddrinfo call, which means both `IPV4` and `IPV6` addresses will be searched simultaneously. | +| REDIS\_OPT\_PREFER\_IPV4
REDIS\_OPT\_PREFER_IPV6
REDIS\_OPT\_PREFER\_UNSPEC | Informs hiredis to either prefer `IPV4` or `IPV6` when invoking [getaddrinfo](https://man7.org/linux/man-pages/man3/gai_strerror.3.html). Note that both of the options may be set at once, which will cause hiredis to spcify `AF_UNSPEC` in the getaddrinfo call, which means both `IPV4` and `IPV6` addresses will be searched simultaneously.
For convenience `REDIS_OPT_PREFER_UNSPEC` can be used which has the same effect as setting both `REDIS_OPT_PREFER_IPV4` and `REDIS_OPT_PREFER_IPV6` flags. | | REDIS\_OPT\_NO\_PUSH\_AUTOFREE | Tells hiredis to not install the default RESP3 PUSH handler (which just intercepts and frees the replies). This is useful in situations where you want to process these messages in-band. | | REDIS\_OPT\_NOAUOTFREEREPLIES | **ASYNC**: tells hiredis not to automatically invoke `freeReplyObject` after executing the reply callback. | | REDIS\_OPT\_NOAUTOFREE | **ASYNC**: Tells hiredis not to automatically free the `redisAsyncContext` on connection/communication failure, but only if the user makes an explicit call to `redisAsyncDisconnect` or `redisAsyncFree` | diff --git a/hiredis.h b/hiredis.h index 1cbdde4aa..692a5afc1 100644 --- a/hiredis.h +++ b/hiredis.h @@ -156,6 +156,7 @@ struct redisSsl; #define REDIS_OPT_REUSEADDR 0x02 #define REDIS_OPT_PREFER_IPV4 0x04 #define REDIS_OPT_PREFER_IPV6 0x08 +#define REDIS_OPT_PREFER_UNSPEC (REDIS_OPT_PREFER_IPV4 | REDIS_OPT_PREFER_IPV6) /** * Don't automatically free the async object on a connection failure, From 1fcdc03b8c6cbe63d101fc46d81e0ec26e1f9451 Mon Sep 17 00:00:00 2001 From: Michael Grunder Date: Fri, 2 Sep 2022 08:58:07 -0700 Subject: [PATCH 2/3] Update hiredis.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Viktor Söderqvist --- hiredis.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hiredis.h b/hiredis.h index 692a5afc1..41cab2db4 100644 --- a/hiredis.h +++ b/hiredis.h @@ -156,7 +156,7 @@ struct redisSsl; #define REDIS_OPT_REUSEADDR 0x02 #define REDIS_OPT_PREFER_IPV4 0x04 #define REDIS_OPT_PREFER_IPV6 0x08 -#define REDIS_OPT_PREFER_UNSPEC (REDIS_OPT_PREFER_IPV4 | REDIS_OPT_PREFER_IPV6) +#define REDIS_OPT_PREFER_IP_UNSPEC (REDIS_OPT_PREFER_IPV4 | REDIS_OPT_PREFER_IPV6) /** * Don't automatically free the async object on a connection failure, From 6b3ea59f39b70630fe7ba6ada0cdf4c982a7e393 Mon Sep 17 00:00:00 2001 From: Michael Grunder Date: Fri, 2 Sep 2022 09:56:04 -0700 Subject: [PATCH 3/3] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Viktor Söderqvist --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e0f315c84..f517800f1 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ There are several flags you may set in the `redisOptions` struct to change defau | --- | --- | | REDIS\_OPT\_NONBLOCK | Tells hiredis to make a non-blocking connection. | | REDIS\_OPT\_REUSEADDR | Tells hiredis to set the [SO_REUSEADDR](https://man7.org/linux/man-pages/man7/socket.7.html) socket option | -| REDIS\_OPT\_PREFER\_IPV4
REDIS\_OPT\_PREFER_IPV6
REDIS\_OPT\_PREFER\_UNSPEC | Informs hiredis to either prefer `IPV4` or `IPV6` when invoking [getaddrinfo](https://man7.org/linux/man-pages/man3/gai_strerror.3.html). Note that both of the options may be set at once, which will cause hiredis to spcify `AF_UNSPEC` in the getaddrinfo call, which means both `IPV4` and `IPV6` addresses will be searched simultaneously.
For convenience `REDIS_OPT_PREFER_UNSPEC` can be used which has the same effect as setting both `REDIS_OPT_PREFER_IPV4` and `REDIS_OPT_PREFER_IPV6` flags. | +| REDIS\_OPT\_PREFER\_IPV4
REDIS\_OPT\_PREFER_IPV6
REDIS\_OPT\_PREFER\_IP\_UNSPEC | Informs hiredis to either prefer IPv4 or IPv6 when invoking [getaddrinfo](https://man7.org/linux/man-pages/man3/gai_strerror.3.html). `REDIS_OPT_PREFER_IP_UNSPEC` will cause hiredis to specify `AF_UNSPEC` in the getaddrinfo call, which means both IPv4 and IPv6 addresses will be searched simultaneously.
Hiredis prefers IPv4 by default. | | REDIS\_OPT\_NO\_PUSH\_AUTOFREE | Tells hiredis to not install the default RESP3 PUSH handler (which just intercepts and frees the replies). This is useful in situations where you want to process these messages in-band. | | REDIS\_OPT\_NOAUOTFREEREPLIES | **ASYNC**: tells hiredis not to automatically invoke `freeReplyObject` after executing the reply callback. | | REDIS\_OPT\_NOAUTOFREE | **ASYNC**: Tells hiredis not to automatically free the `redisAsyncContext` on connection/communication failure, but only if the user makes an explicit call to `redisAsyncDisconnect` or `redisAsyncFree` |