hiredis-client 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ab993c8bd2fc54e8817b047d657409ee3cf3ab8256884c052358cf4178d2835
|
4
|
+
data.tar.gz: 49298a0eedee98b454ece01d08de52d68291383ceccc5146f129cab4f2d87095
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1994b4d87d9b0ca699f4ab9a1b35d7f58834e1186ce8df4dbb57958b4a3a4e7db5379efa9e27c62ab01245c8d354babdd9a173234eaebfbb6e2187b8910ad419
|
7
|
+
data.tar.gz: 8bdfe9124ab8b8b491bd90b5effef54465bcf512c18fefe84c8af83dad396306d5cbd88e02ce84fd9db6835766bdbbcb055a2b3cc52a33cf149decbd802736f6
|
@@ -311,14 +311,28 @@ static VALUE hiredis_alloc(VALUE klass) {
|
|
311
311
|
return TypedData_Make_Struct(klass, hiredis_connection_t, &hiredis_connection_data_type, connection);
|
312
312
|
}
|
313
313
|
|
314
|
+
void redis_set_io_error(redisContext *context, int err) {
|
315
|
+
if (err) {
|
316
|
+
errno = err;
|
317
|
+
}
|
318
|
+
context->err = REDIS_ERR_IO;
|
319
|
+
(void)!strerror_r(errno, context->errstr, sizeof(context->errstr));
|
320
|
+
}
|
321
|
+
|
314
322
|
static inline void redis_raise_error_and_disconnect(redisContext *context, VALUE timeout_error) {
|
315
323
|
if (!context) return;
|
316
324
|
|
317
325
|
int err = context->err;
|
318
326
|
char errstr[128];
|
319
|
-
|
327
|
+
if (context->err) {
|
328
|
+
strncpy(errstr, context->errstr, 128);
|
329
|
+
}
|
320
330
|
redisFree(context);
|
321
331
|
|
332
|
+
if (!err) {
|
333
|
+
rb_raise(timeout_error, "Unknown Error");
|
334
|
+
}
|
335
|
+
|
322
336
|
// OpenSSL bug: The SSL_ERROR_SYSCALL with errno value of 0 indicates unexpected EOF from the peer.
|
323
337
|
if (errno == EAGAIN || (err == REDIS_ERR_IO && errno == 0)) {
|
324
338
|
errno = 0;
|
@@ -431,26 +445,28 @@ static VALUE hiredis_connect_finish(hiredis_connection_t *connection, redisConte
|
|
431
445
|
|
432
446
|
int writable = 0;
|
433
447
|
int optval = 0;
|
448
|
+
errno = 0;
|
434
449
|
socklen_t optlen = sizeof(optval);
|
435
450
|
|
436
451
|
/* Wait for socket to become writable */
|
437
452
|
if (hiredis_wait_writable(context->fd, &connection->connect_timeout, &writable) < 0) {
|
453
|
+
redis_set_io_error(context, ETIMEDOUT);
|
438
454
|
redis_raise_error_and_disconnect(context, rb_eRedisClientCannotConnectError);
|
439
455
|
}
|
440
456
|
|
441
457
|
if (!writable) {
|
442
|
-
|
458
|
+
redis_set_io_error(context, ETIMEDOUT);
|
443
459
|
redis_raise_error_and_disconnect(context, rb_eRedisClientCannotConnectError);
|
444
460
|
}
|
445
461
|
|
446
462
|
/* Check for socket error */
|
447
463
|
if (getsockopt(context->fd, SOL_SOCKET, SO_ERROR, &optval, &optlen) < 0) {
|
448
|
-
context
|
464
|
+
redis_set_io_error(context, 0);
|
449
465
|
redis_raise_error_and_disconnect(context, rb_eRedisClientCannotConnectError);
|
450
466
|
}
|
451
467
|
|
452
468
|
if (optval) {
|
453
|
-
|
469
|
+
redis_set_io_error(context, optval);
|
454
470
|
redis_raise_error_and_disconnect(context, rb_eRedisClientCannotConnectError);
|
455
471
|
}
|
456
472
|
|
@@ -935,8 +935,9 @@ int redisBufferRead(redisContext *c) {
|
|
935
935
|
int nread;
|
936
936
|
|
937
937
|
/* Return early when the context has seen an error. */
|
938
|
-
if (c->err)
|
938
|
+
if (c->err) {
|
939
939
|
return REDIS_ERR;
|
940
|
+
}
|
940
941
|
|
941
942
|
nread = c->funcs->read(c, buf, sizeof(buf));
|
942
943
|
if (nread > 0) {
|
@@ -41,7 +41,12 @@ class RedisClient
|
|
41
41
|
raise CannotConnectError, error.message, error.backtrace
|
42
42
|
end
|
43
43
|
else
|
44
|
-
|
44
|
+
begin
|
45
|
+
connect_tcp(config.host, config.port)
|
46
|
+
rescue SystemCallError => error
|
47
|
+
error_code = error.class.name.split("::").last
|
48
|
+
raise CannotConnectError, "Failed to connect to #{config.host}:#{config.port} (#{error_code})"
|
49
|
+
end
|
45
50
|
end
|
46
51
|
|
47
52
|
if config.ssl
|
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.10.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: 2022-
|
11
|
+
date: 2022-10-10 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.10.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.10.0
|
27
27
|
description:
|
28
28
|
email:
|
29
29
|
- jean.boussier@gmail.com
|