hiredis-client 0.8.0 → 0.8.1

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: 026fd9b702f8f490d0d2aa363e28ee61dabe8f0d477c8436e7df2460c356b0a4
4
- data.tar.gz: 71cd542065a48fc85f3e90c9d19077048459575bfa72ab3987190d188cc33284
3
+ metadata.gz: f18d435747c2eee26d1df005dc5f2dfe4941cec30a74baf90dd56d54a410c216
4
+ data.tar.gz: d38390db3e0a413525bfced8e86761e633cf5af0a7e7e8d28a90ed79e3930fac
5
5
  SHA512:
6
- metadata.gz: 1a9c6a8c8ddbfdc758ec14db5f42fb73dfc1bc3f1885478375f45017a22b191a7757aefffd22f0cc8db354b93513e69998b2c7b5b6d3266028d7ed629cb09064
7
- data.tar.gz: 749f5192abd2c44d3f90a4c27db809f932377534f6bbc44256e1fb6948b112a2a61b9658a491e134d30d93798cdd43d378a40f69bf20bca44b6ef5b9b5bbc938
6
+ metadata.gz: 1810b9bc04e01d77af516a659ac1dd565607b3473e19b3f88522b71609f5559fc0427d33e764fa4f147211c7e6e7440e2c8cc4e671d8bd6419d504398220709f
7
+ data.tar.gz: 96da9a05db116378d827bfbbedf11ff4e9cb634245fc5423c235f407934a95b54671e2cf90511fb528ef3af04d99d07c842add3deb8316a2bab3af3a66ed7fa1
@@ -48,6 +48,7 @@ static inline VALUE rb_hash_new_capa(long capa)
48
48
 
49
49
  static VALUE rb_eRedisClientCommandError, rb_eRedisClientConnectionError, rb_eRedisClientCannotConnectError, rb_eRedisClientProtocolError;
50
50
  static VALUE rb_eRedisClientReadTimeoutError, rb_eRedisClientWriteTimeoutError;
51
+ static VALUE Redis_Qfalse;
51
52
  static ID id_parse;
52
53
 
53
54
  typedef struct {
@@ -200,8 +201,8 @@ static void *reply_create_nil(const redisReadTask *task) {
200
201
  static void *reply_create_bool(const redisReadTask *task, int bval) {
201
202
  reply_append(task, bval ? Qtrue : Qfalse);
202
203
  // Qfalse == NULL, so we can't return Qfalse as it would be interpreted as out of memory error.
203
- // So we return Qnil instead.
204
- return (void*)(bval ? Qtrue : Qnil);
204
+ // So we return a token value instead and the caller is responsible for turning it into Qfalse.
205
+ return (void*)(bval ? Qtrue : Redis_Qfalse);
205
206
  }
206
207
 
207
208
  static void reply_free(void *ptr) {
@@ -683,6 +684,10 @@ static VALUE hiredis_read(VALUE self) {
683
684
  if (hiredis_read_internal(connection, &reply)) {
684
685
  hiredis_raise_error_and_disconnect(connection, rb_eRedisClientReadTimeoutError);
685
686
  }
687
+ if (reply == Redis_Qfalse) {
688
+ // See reply_create_bool
689
+ reply = Qfalse;
690
+ }
686
691
  return reply;
687
692
  }
688
693
 
@@ -705,6 +710,8 @@ void Init_hiredis_connection(void) {
705
710
  redisInitOpenSSL();
706
711
 
707
712
  id_parse = rb_intern("parse");
713
+ Redis_Qfalse = rb_obj_alloc(rb_cObject);
714
+ rb_global_variable(&Redis_Qfalse);
708
715
 
709
716
  VALUE rb_cRedisClient = rb_const_get(rb_cObject, rb_intern("RedisClient"));
710
717
 
@@ -29,6 +29,7 @@ class RedisClient
29
29
  end
30
30
 
31
31
  def initialize(config, connect_timeout:, read_timeout:, write_timeout:)
32
+ super()
32
33
  self.connect_timeout = connect_timeout
33
34
  self.read_timeout = read_timeout
34
35
  self.write_timeout = write_timeout
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.8.0
4
+ version: 0.8.1
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-09-07 00:00:00.000000000 Z
11
+ date: 2022-09-16 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.8.0
19
+ version: 0.8.1
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.8.0
26
+ version: 0.8.1
27
27
  description:
28
28
  email:
29
29
  - jean.boussier@gmail.com