hiredis-client 0.8.0 → 0.9.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: 026fd9b702f8f490d0d2aa363e28ee61dabe8f0d477c8436e7df2460c356b0a4
4
- data.tar.gz: 71cd542065a48fc85f3e90c9d19077048459575bfa72ab3987190d188cc33284
3
+ metadata.gz: 834e7347f7934e084b79647b8a179f2297e9e3ef29fce477a0d4a7c76ed99989
4
+ data.tar.gz: 121469ded1e076737990f7c6ce1ec86666cf4194dca2707fd1fa5645b63c3d6d
5
5
  SHA512:
6
- metadata.gz: 1a9c6a8c8ddbfdc758ec14db5f42fb73dfc1bc3f1885478375f45017a22b191a7757aefffd22f0cc8db354b93513e69998b2c7b5b6d3266028d7ed629cb09064
7
- data.tar.gz: 749f5192abd2c44d3f90a4c27db809f932377534f6bbc44256e1fb6948b112a2a61b9658a491e134d30d93798cdd43d378a40f69bf20bca44b6ef5b9b5bbc938
6
+ metadata.gz: 8f67fbd4582aaadbe6d7a2da0ce68bf45a9a712914e270de8e97511af579905033bfa5aa83c6055a38771078be87cdbb36e0883f5be471cfb3feb92cc5363007
7
+ data.tar.gz: 114644f547ddf1c707f76b04d53a8876d06f075aa66056d7185edcd86143643307dd06265e5f7a1446af0f207ac7c547f07e5ff9799c8b69b1816e4735c6f266
@@ -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.9.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-09-07 00:00:00.000000000 Z
11
+ date: 2022-09-22 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.9.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.8.0
26
+ version: 0.9.0
27
27
  description:
28
28
  email:
29
29
  - jean.boussier@gmail.com