hiredis-client 0.12.2 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc000cc925b26584a60d6a74360cf9b39db974e718c6be6af4f19f7e4ac77051
|
4
|
+
data.tar.gz: f54b30ef2a1310200d60d76e310a1ea750001affe145c0994a59e262934e6865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d386889884c0a22a1e44ed346f659aa8f95e74be3363ba891b2ac372efb3b02f18bc14e6ccbe347a6e6f3daae3d48cf376dcb10793272db96574233108157177
|
7
|
+
data.tar.gz: e5264e89206c6d5d723cc1b814867c0e9420ec1f904ca6596a23b840bcc2a0ffe3ae5e2ff9e1069e841eb61d3040d5e916a325a8bb1b325a6b7508261a2df224
|
@@ -480,7 +480,11 @@ static VALUE hiredis_connect_tcp(VALUE self, VALUE host, VALUE port) {
|
|
480
480
|
redisFree(connection->context);
|
481
481
|
connection->context = NULL;
|
482
482
|
}
|
483
|
-
|
483
|
+
redisContext *context = redisConnectNonBlock(StringValuePtr(host), NUM2INT(port));
|
484
|
+
if (context) {
|
485
|
+
redisEnableKeepAlive(context);
|
486
|
+
}
|
487
|
+
return hiredis_connect_finish(connection, context);
|
484
488
|
}
|
485
489
|
|
486
490
|
static VALUE hiredis_connect_unix(VALUE self, VALUE path) {
|
@@ -913,7 +913,7 @@ int redisSetTimeout(redisContext *c, const struct timeval tv) {
|
|
913
913
|
|
914
914
|
/* Enable connection KeepAlive. */
|
915
915
|
int redisEnableKeepAlive(redisContext *c) {
|
916
|
-
if (redisKeepAlive(c, REDIS_KEEPALIVE_INTERVAL) != REDIS_OK)
|
916
|
+
if (redisKeepAlive(c, REDIS_KEEPALIVE_TTL, REDIS_KEEPALIVE_INTERVAL) != REDIS_OK)
|
917
917
|
return REDIS_ERR;
|
918
918
|
return REDIS_OK;
|
919
919
|
}
|
@@ -87,6 +87,7 @@ typedef long long ssize_t;
|
|
87
87
|
#define REDIS_NO_AUTO_FREE 0x200
|
88
88
|
|
89
89
|
#define REDIS_KEEPALIVE_INTERVAL 15 /* seconds */
|
90
|
+
#define REDIS_KEEPALIVE_TTL 120 /* seconds */
|
90
91
|
|
91
92
|
/* number of times we retry to connect in the case of EADDRNOTAVAIL and
|
92
93
|
* SO_REUSEADDR is being used. */
|
@@ -162,7 +162,7 @@ static int redisSetBlocking(redisContext *c, int blocking) {
|
|
162
162
|
return REDIS_OK;
|
163
163
|
}
|
164
164
|
|
165
|
-
int redisKeepAlive(redisContext *c, int interval) {
|
165
|
+
int redisKeepAlive(redisContext *c, int ttl, int interval) {
|
166
166
|
int val = 1;
|
167
167
|
redisFD fd = c->fd;
|
168
168
|
|
@@ -171,28 +171,28 @@ int redisKeepAlive(redisContext *c, int interval) {
|
|
171
171
|
return REDIS_ERR;
|
172
172
|
}
|
173
173
|
|
174
|
-
val = interval;
|
175
|
-
|
176
174
|
#if defined(__APPLE__) && defined(__MACH__)
|
175
|
+
val = ttl;
|
177
176
|
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &val, sizeof(val)) < 0) {
|
178
177
|
__redisSetError(c,REDIS_ERR_OTHER,strerror(errno));
|
179
178
|
return REDIS_ERR;
|
180
179
|
}
|
181
180
|
#else
|
182
181
|
#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__)
|
182
|
+
val = interval;
|
183
183
|
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &val, sizeof(val)) < 0) {
|
184
184
|
__redisSetError(c,REDIS_ERR_OTHER,strerror(errno));
|
185
185
|
return REDIS_ERR;
|
186
186
|
}
|
187
187
|
|
188
|
-
val = interval
|
189
|
-
if (val == 0) val = 1;
|
188
|
+
val = interval;
|
190
189
|
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &val, sizeof(val)) < 0) {
|
191
190
|
__redisSetError(c,REDIS_ERR_OTHER,strerror(errno));
|
192
191
|
return REDIS_ERR;
|
193
192
|
}
|
194
193
|
|
195
|
-
val =
|
194
|
+
val = (ttl / interval) - 1;
|
195
|
+
if (val <= 0) val = 1;
|
196
196
|
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &val, sizeof(val)) < 0) {
|
197
197
|
__redisSetError(c,REDIS_ERR_OTHER,strerror(errno));
|
198
198
|
return REDIS_ERR;
|
@@ -48,7 +48,7 @@ int redisContextConnectBindTcp(redisContext *c, const char *addr, int port,
|
|
48
48
|
const struct timeval *timeout,
|
49
49
|
const char *source_addr);
|
50
50
|
int redisContextConnectUnix(redisContext *c, const char *path, const struct timeval *timeout);
|
51
|
-
int redisKeepAlive(redisContext *c, int interval);
|
51
|
+
int redisKeepAlive(redisContext *c, int ttl, int interval);
|
52
52
|
int redisCheckConnectDone(redisContext *c, int *completed);
|
53
53
|
|
54
54
|
int redisSetTcpNoDelay(redisContext *c);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiredis-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-client
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.13.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.13.0
|
27
27
|
description:
|
28
28
|
email:
|
29
29
|
- jean.boussier@gmail.com
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
|
-
rubygems_version: 3.4.
|
108
|
+
rubygems_version: 3.4.6
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Hiredis binding for redis-client
|