async-io 1.27.6 → 1.27.7

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: 8e0bff7f13a902bd5ef577d7a36d067f482c4d02001dfe1111ef83cb549187fd
4
- data.tar.gz: 80aa5c4aaf1da1f1fe9df08779f9be5e03168b4ba42a3a8e83b19c3b4b5205f2
3
+ metadata.gz: f36b84a41e617dbb5ffd863ecaf7b68761f6cdbc4969052372ef67071e98b85b
4
+ data.tar.gz: 5c655fceda94aaae5b17166e7c039e60558dee99755875dbaa51e1f58244f2a0
5
5
  SHA512:
6
- metadata.gz: 9a6cd691bc26134513232ae20b4d7c38c7807fe697360537a690fd504099b825e546c6be4cd7fbb50d50164f55d46a02a0a5986a1ee97b64673342442886cf84
7
- data.tar.gz: cf04dd4be38376c52b76c88233b5de97b58e7dc4ce14cac2a9d68824dc5489db3e192fb0d29bb8101d15a2172ffce66be51e9914a8b22b65807cd17a8cb4f583
6
+ metadata.gz: d3fa287b88b45a084bf750cbd5343f02ad0848c0340ba653937933aeec0c980a61e779c6322afcbcb9ada9fd263d92a35fd9b8d5fb5616df3e9d535d06cb6a8b
7
+ data.tar.gz: ca1ea7afbee6741820cd9b058fc1bcaa2b1b1f89352280a484ca1ae5732fd2447ec71f4b06deb0d5d0d965e80a00bb17c567ea3188a11c1368eaa26c976a66a4
@@ -150,11 +150,18 @@ module Async
150
150
  # Flushes buffered data to the stream.
151
151
  def flush(deferred: @deferred)
152
152
  if deferred and task = Task.current?
153
+ # Despite how it looks, this field is not actually directly related to whether or not writes should occur. It's actually used to control the logic of deferred flushing. Therefore, it should NOT be modified outside this method.
153
154
  @pending += 1
154
155
 
155
156
  if @pending == 1
156
157
  task.yield
157
- drain_write_buffer unless @write_buffer.empty?
158
+
159
+ begin
160
+ drain_write_buffer unless @write_buffer.empty?
161
+ ensure
162
+ # The write buffer no longer contains pending writes
163
+ @pending = 0
164
+ end
158
165
  end
159
166
  else
160
167
  drain_write_buffer unless @write_buffer.empty?
@@ -243,6 +250,7 @@ module Async
243
250
 
244
251
  private
245
252
 
253
+ # For efficiency purposes, only call this method when the write buffer is not empty.
246
254
  def drain_write_buffer
247
255
  @writing.acquire do
248
256
  Async.logger.debug(self) do |buffer|
@@ -259,9 +267,6 @@ module Async
259
267
  # Flip the write buffer and drain buffer:
260
268
  @write_buffer, @drain_buffer = @drain_buffer, @write_buffer
261
269
 
262
- # The write buffer no longer contains pending writes:
263
- @pending = 0
264
-
265
270
  begin
266
271
  @io.write(@drain_buffer)
267
272
  ensure
@@ -279,9 +284,7 @@ module Async
279
284
  end
280
285
 
281
286
  # This effectively ties the input and output stream together.
282
- if @pending > 0
283
- drain_write_buffer
284
- end
287
+ drain_write_buffer unless @write_buffer.empty?
285
288
 
286
289
  if @read_buffer.empty?
287
290
  if @io.read_nonblock(size, @read_buffer, exception: false)
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Async
24
24
  module IO
25
- VERSION = "1.27.6"
25
+ VERSION = "1.27.7"
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.27.6
4
+ version: 1.27.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-29 00:00:00.000000000 Z
11
+ date: 2020-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  requirements: []
214
- rubygems_version: 3.0.6
214
+ rubygems_version: 3.1.2
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: Provides support for asynchonous TCP, UDP, UNIX and SSL sockets.