async-io 1.36.0 → 1.37.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: f45b658e692b5426b037f69b266fe095c3ee61320f5db8ccc2469d66bb923c22
4
- data.tar.gz: 89133ec5eb471eef5c72e1e35dec328c3193438ba4f0c18e7978ce1a8d3dc49a
3
+ metadata.gz: 49d719dcbd7c58913d56771c96160e6c0f339511e853d943a3b18405acaf7937
4
+ data.tar.gz: 112e32a37cb07630becdfc0b19b42b95ad7d4eb57f52801c065808a2e685317f
5
5
  SHA512:
6
- metadata.gz: 883d047a96a021dcdb347c41b5872fb74dc9e573ba5123dce66facd6cc9729c032d5153e9fc992cf1031f7f9cc5a30d28f176d29b7a1d5218b3b6f9a9a72316f
7
- data.tar.gz: db3dfd29a52b2a22d8296873f0ddd5ae9599b13ec5b51f0c25dce596aa53e46bda425452d7977d5f0f750531e7d10f1cf8dd828626c653604c4149008f14ed9b
6
+ metadata.gz: daf5665bf25cc38327e9f001e2a79080c2f34991d41a66cf8e614e5e2f0b51b2e4724bc9d06190c24fd98c70c270533620bb039181a9ac948a4dcb415b3d7f7f
7
+ data.tar.gz: 478bcf25e70b1b52a71c7b382450c8cef8d82bfcc06b412cfe006cc73cd494a23b75b520bb7bc5dddcd915af4f44f56b3038497599024a5bec64fe23b6cf5d9d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -125,10 +125,21 @@ module Async
125
125
  return matched
126
126
  end
127
127
 
128
- def peek
129
- until yield(@read_buffer) or @eof
128
+ def peek(size = nil)
129
+ if size
130
+ until @eof or @read_buffer.bytesize >= size
131
+ # Compute the amount of data we need to read from the underlying stream:
132
+ read_size = size - @read_buffer.bytesize
133
+
134
+ # Don't read less than @block_size to avoid lots of small reads:
135
+ fill_read_buffer(read_size > @block_size ? read_size : @block_size)
136
+ end
137
+ return @read_buffer[..([size, @read_buffer.size].min - 1)]
138
+ end
139
+ until (block_given? && yield(@read_buffer)) or @eof
130
140
  fill_read_buffer
131
141
  end
142
+ return @read_buffer
132
143
  end
133
144
 
134
145
  def gets(separator = $/, **options)
@@ -35,8 +35,8 @@ module Async
35
35
  Socket.bind(@address, **@options, &block)
36
36
  rescue Errno::EADDRINUSE
37
37
  # If you encounter EADDRINUSE from `bind()`, you can check if the socket is actually accepting connections by attempting to `connect()` to it. If the socket is still bound by an active process, the connection will succeed. Otherwise, it should be safe to `unlink()` the path and try again.
38
- if !bound? && File.exist?(@path)
39
- File.unlink(@path)
38
+ if !bound?
39
+ File.unlink(@path) rescue nil
40
40
  retry
41
41
  else
42
42
  raise
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module IO
8
- VERSION = "1.36.0"
8
+ VERSION = "1.37.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.36.0
4
+ version: 1.37.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -46,7 +46,7 @@ cert_chain:
46
46
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
47
47
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
48
48
  -----END CERTIFICATE-----
49
- date: 2023-09-11 00:00:00.000000000 Z
49
+ date: 2023-11-10 00:00:00.000000000 Z
50
50
  dependencies:
51
51
  - !ruby/object:Gem::Dependency
52
52
  name: async
metadata.gz.sig CHANGED
Binary file