async-io 1.42.1 → 1.43.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: 6afc5e61a16e8a24417941c0af97c02fabb0b33e42de475d9079f4f432998306
4
- data.tar.gz: eaa655260a5afea4c6a07c9c86e2d14d6173e1c72ffca7915f233aec02e1132b
3
+ metadata.gz: 071d4c65cf79b0114f950285653b697d06949878a919fa256806f7c9dae40253
4
+ data.tar.gz: 5f9610ec6b8e8de0c4160c1e66d07b1549c9cbbf286bbb5443f033c5399ae549
5
5
  SHA512:
6
- metadata.gz: 285d47cc095bc289bcf74d5bbdc82ee075ed3686c3b4f9b6629a2a8f6d772aa6471b2d5286201c3f70e9f84a08a17c95e6e55a57d67b50b32986021db86a6b09
7
- data.tar.gz: 88963601065a90d4b1da7af1065ce62591466e189be2f21de99917e43f79401ab4ef03f3578029a0dc477088f4d0e6486627cd3e950920fcdc865935b0a8b951
6
+ metadata.gz: f86354aec7425c48afb078885c6e80accbed2f534802a12063d190db78b129140ffd1739293072cd95e8b94b08870c1a1b856c7cd8931e0f45ff7ed909b4b830
7
+ data.tar.gz: 658b16d8c97799b3d5acfa7e78c2b4e542b9835ca2aa236ee378c39f612f4683fd17be6e3d924a2c673ccbadd021531f3c921bce1e82d35175c80a799a88d77e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -192,6 +192,10 @@ module Async
192
192
  !@io.closed?
193
193
  end
194
194
 
195
+ def readable?
196
+ @io.readable?
197
+ end
198
+
195
199
  attr_accessor :timeout
196
200
 
197
201
  protected
@@ -51,10 +51,14 @@ module Async
51
51
  super
52
52
  else
53
53
  io = self.class.wrapped_klass.new(socket.to_io, context)
54
- super(io, socket.reactor)
55
-
56
- # We detach the socket from the reactor, otherwise it's possible to add the file descriptor to the selector twice, which is bad.
57
- socket.reactor = nil
54
+ if socket.respond_to?(:reactor)
55
+ super(io, socket.reactor)
56
+
57
+ # We detach the socket from the reactor, otherwise it's possible to add the file descriptor to the selector twice, which is bad.
58
+ socket.reactor = nil
59
+ else
60
+ super(io)
61
+ end
58
62
 
59
63
  # This ensures that when the internal IO is closed, it also closes the internal socket:
60
64
  io.sync_close = true
@@ -197,6 +197,10 @@ module Async
197
197
  @io.connected?
198
198
  end
199
199
 
200
+ def readable?
201
+ @io.readable?
202
+ end
203
+
200
204
  def closed?
201
205
  @io.closed?
202
206
  end
@@ -246,6 +250,21 @@ module Async
246
250
 
247
251
  private
248
252
 
253
+ def sysread(size, buffer)
254
+ while true
255
+ result = @io.read_nonblock(size, buffer, exception: false)
256
+
257
+ case result
258
+ when :wait_readable
259
+ @io.wait_readable
260
+ when :wait_writable
261
+ @io.wait_writable
262
+ else
263
+ return result
264
+ end
265
+ end
266
+ end
267
+
249
268
  # Fills the buffer from the underlying stream.
250
269
  def fill_read_buffer(size = @block_size)
251
270
  # We impose a limit because the underlying `read` system call can fail if we request too much data in one go.
@@ -257,12 +276,12 @@ module Async
257
276
  flush
258
277
 
259
278
  if @read_buffer.empty?
260
- if @io.read_nonblock(size, @read_buffer, exception: false)
279
+ if sysread(size, @read_buffer)
261
280
  # Console.logger.debug(self, name: "read") {@read_buffer.inspect}
262
281
  return true
263
282
  end
264
283
  else
265
- if chunk = @io.read_nonblock(size, @input_buffer, exception: false)
284
+ if chunk = sysread(size, @input_buffer)
266
285
  @read_buffer << chunk
267
286
  # Console.logger.debug(self, name: "read") {@read_buffer.inspect}
268
287
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module IO
8
- VERSION = "1.42.1"
8
+ VERSION = "1.43.0"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.42.1
4
+ version: 1.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -49,7 +49,7 @@ cert_chain:
49
49
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
50
50
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
51
51
  -----END CERTIFICATE-----
52
- date: 2024-04-16 00:00:00.000000000 Z
52
+ date: 2024-04-23 00:00:00.000000000 Z
53
53
  dependencies:
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: async
metadata.gz.sig CHANGED
Binary file