hiredis-client 0.22.2 → 0.23.1

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: 5cd9b778e1204bac29d3ca9ebea612bf117a1c60a3423d9a2ca8af95525ca081
4
- data.tar.gz: b24b71653afb4da0b6733f61272edb161983a2baedb48554a39be671056fb896
3
+ metadata.gz: 119463fcaf132ff2c8f57dee7ea75253b56f7b1550c61a8d2d533655054459df
4
+ data.tar.gz: 0e0ee26428dbad181242270ffa21bbf6f1f48071737af9d5f47896ad082908bb
5
5
  SHA512:
6
- metadata.gz: 73280748aba20c1794d0e7cc1e8f92d62a5fe7495eb0284f9a38f766af1bf45e6fd2165b1dac0ef9ab035ca17466133d7fec8b326911eb64872837953ef2ce57
7
- data.tar.gz: c4f6ca4d2b079c1f022d83849c2efb6052b8157afb16349a297df1d1edb8baf40994d354bc271bbe8af137b67df5c2ca4b962f853da610bf7d5b44e8e09782c8
6
+ metadata.gz: 394d49dbed0c4479237125656b4e8c75fe6b35189fb3e28279f18cd05873e91a1cea88185834a77065be750d4edc8c0c7f071dd0daae51471f5cbacbfb666362
7
+ data.tar.gz: 9ee93b3a4815bcdf51f07991ffecb3a00c5db4bd699c620f1cf53221975fbde8b33a03c20216be2b07c3a2952176cc356db7d1618c1cc35ee1829e01bbd311af
@@ -321,6 +321,7 @@ typedef struct {
321
321
  struct timeval connect_timeout;
322
322
  struct timeval read_timeout;
323
323
  struct timeval write_timeout;
324
+ hiredis_reader_state_t reader_state;
324
325
  } hiredis_connection_t;
325
326
 
326
327
  static void hiredis_connection_free(void *ptr) {
@@ -719,74 +720,47 @@ static VALUE hiredis_flush(VALUE self) {
719
720
 
720
721
  static int hiredis_read_internal(hiredis_connection_t *connection, VALUE *reply) {
721
722
  void *redis_reply = NULL;
722
- int wdone = 0;
723
723
 
724
- // This struct being on the stack, the GC won't move nor collect that `stack` RArray.
724
+ // This array being on the stack, the GC won't move nor collect it.
725
725
  // We use that to avoid having to have a `mark` function with write barriers.
726
726
  // Not that it would be too hard, but if we mark the response objects, we'll likely end up
727
727
  // promoting them to the old generation which isn't desirable.
728
728
  VALUE stack = rb_ary_new();
729
- hiredis_reader_state_t reader_state = {
730
- .stack = stack,
731
- .task_index = &connection->context->reader->ridx,
732
- };
733
- connection->context->reader->privdata = &reader_state;
729
+ connection->reader_state.stack = stack;
730
+ connection->reader_state.task_index = &connection->context->reader->ridx;
731
+ connection->context->reader->privdata = &connection->reader_state;
734
732
 
735
733
  /* Try to read pending replies */
736
734
  if (redisGetReplyFromReader(connection->context, &redis_reply) == REDIS_ERR) {
737
735
  return HIREDIS_FATAL_CONNECTION_ERROR; // Protocol error
738
736
  }
739
737
 
740
- if (redis_reply == NULL) {
741
- /* Write until the write buffer is drained */
742
- while (!wdone) {
743
- errno = 0;
744
-
745
- if (hiredis_buffer_write_nogvl(connection->context, &wdone) == REDIS_ERR) {
746
- return HIREDIS_FATAL_CONNECTION_ERROR; // Socket error
747
- }
748
-
749
- if (errno == EAGAIN) {
750
- int writable = 0;
751
-
752
- if (hiredis_wait_writable(connection->context->fd, &connection->write_timeout, &writable) < 0) {
753
- return HIREDIS_CLIENT_TIMEOUT;
754
- }
738
+ /* Read until there is a full reply */
739
+ while (redis_reply == NULL) {
740
+ errno = 0;
755
741
 
756
- if (!writable) {
757
- errno = EAGAIN;
758
- return HIREDIS_CLIENT_TIMEOUT;
759
- }
760
- }
742
+ if (hiredis_buffer_read_nogvl(connection->context) == REDIS_ERR) {
743
+ return HIREDIS_FATAL_CONNECTION_ERROR; // Socket error
761
744
  }
762
745
 
763
- /* Read until there is a full reply */
764
- while (redis_reply == NULL) {
765
- errno = 0;
746
+ if (errno == EAGAIN) {
747
+ int readable = 0;
766
748
 
767
- if (hiredis_buffer_read_nogvl(connection->context) == REDIS_ERR) {
768
- return HIREDIS_FATAL_CONNECTION_ERROR; // Socket error
749
+ if (hiredis_wait_readable(connection->context->fd, &connection->read_timeout, &readable) < 0) {
750
+ return HIREDIS_CLIENT_TIMEOUT;
769
751
  }
770
752
 
771
- if (errno == EAGAIN) {
772
- int readable = 0;
773
-
774
- if (hiredis_wait_readable(connection->context->fd, &connection->read_timeout, &readable) < 0) {
775
- return HIREDIS_CLIENT_TIMEOUT;
776
- }
777
-
778
- if (!readable) {
779
- errno = EAGAIN;
780
- return HIREDIS_CLIENT_TIMEOUT;
781
- }
782
-
783
- /* Retry */
784
- continue;
753
+ if (!readable) {
754
+ errno = EAGAIN;
755
+ return HIREDIS_CLIENT_TIMEOUT;
785
756
  }
786
757
 
787
- if (redisGetReplyFromReader(connection->context, &redis_reply) == REDIS_ERR) {
788
- return HIREDIS_FATAL_CONNECTION_ERROR; // Protocol error
789
- }
758
+ /* Retry */
759
+ continue;
760
+ }
761
+
762
+ if (redisGetReplyFromReader(connection->context, &redis_reply) == REDIS_ERR) {
763
+ return HIREDIS_FATAL_CONNECTION_ERROR; // Protocol error
790
764
  }
791
765
  }
792
766
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiredis-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.2
4
+ version: 0.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-05-22 00:00:00.000000000 Z
10
+ date: 2025-01-12 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: redis-client
@@ -16,15 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: 0.22.2
18
+ version: 0.23.1
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: 0.22.2
27
- description:
25
+ version: 0.23.1
28
26
  email:
29
27
  - jean.boussier@gmail.com
30
28
  executables: []
@@ -79,7 +77,6 @@ files:
79
77
  - ext/redis_client/hiredis/vendor/test.c
80
78
  - ext/redis_client/hiredis/vendor/test.sh
81
79
  - ext/redis_client/hiredis/vendor/win32.h
82
- - hiredis-client.gemspec
83
80
  - lib/hiredis-client.rb
84
81
  - lib/redis_client/hiredis_connection.rb
85
82
  homepage: https://github.com/redis-rb/redis-client
@@ -90,7 +87,6 @@ metadata:
90
87
  homepage_uri: https://github.com/redis-rb/redis-client
91
88
  source_code_uri: https://github.com/redis-rb/redis-client
92
89
  changelog_uri: https://github.com/redis-rb/redis-client/blob/master/CHANGELOG.md
93
- post_install_message:
94
90
  rdoc_options: []
95
91
  require_paths:
96
92
  - lib
@@ -105,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
101
  - !ruby/object:Gem::Version
106
102
  version: '0'
107
103
  requirements: []
108
- rubygems_version: 3.5.9
109
- signing_key:
104
+ rubygems_version: 3.6.2
110
105
  specification_version: 4
111
106
  summary: Hiredis binding for redis-client
112
107
  test_files: []
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../lib/redis_client/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "hiredis-client"
7
- spec.version = RedisClient::VERSION
8
- spec.authors = ["Jean Boussier"]
9
- spec.email = ["jean.boussier@gmail.com"]
10
-
11
- spec.summary = "Hiredis binding for redis-client"
12
- spec.homepage = "https://github.com/redis-rb/redis-client"
13
- spec.license = "MIT"
14
- spec.required_ruby_version = ">= 2.6.0"
15
-
16
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
-
18
- spec.metadata["homepage_uri"] = spec.homepage
19
- spec.metadata["source_code_uri"] = spec.homepage
20
- spec.metadata["changelog_uri"] = File.join(spec.homepage, "blob/master/CHANGELOG.md")
21
-
22
- # Specify which files should be added to the gem when it is released.
23
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
- `git ls-files -z`.split("\x0").reject do |f|
26
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features|benchmark)/|\.(?:git|rubocop))})
27
- end
28
- end
29
- spec.require_paths = ["lib"]
30
- spec.extensions = ["ext/redis_client/hiredis/extconf.rb"]
31
-
32
- spec.add_runtime_dependency "redis-client", RedisClient::VERSION
33
- end