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 +4 -4
- data/lib/async/io/stream.rb +10 -7
- data/lib/async/io/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f36b84a41e617dbb5ffd863ecaf7b68761f6cdbc4969052372ef67071e98b85b
|
4
|
+
data.tar.gz: 5c655fceda94aaae5b17166e7c039e60558dee99755875dbaa51e1f58244f2a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3fa287b88b45a084bf750cbd5343f02ad0848c0340ba653937933aeec0c980a61e779c6322afcbcb9ada9fd263d92a35fd9b8d5fb5616df3e9d535d06cb6a8b
|
7
|
+
data.tar.gz: ca1ea7afbee6741820cd9b058fc1bcaa2b1b1f89352280a484ca1ae5732fd2447ec71f4b06deb0d5d0d965e80a00bb17c567ea3188a11c1368eaa26c976a66a4
|
data/lib/async/io/stream.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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)
|
data/lib/async/io/version.rb
CHANGED
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.
|
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-
|
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.
|
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.
|