async-http 0.50.10 → 0.50.11

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: fde1aeafebf3bc36dc76d397da2b9b229abe58c97afe7c0ea938f671ea653765
4
- data.tar.gz: d5c26ad0fbeddf88e3456148879cc89084e2a19fe1a0efa5d5effe403bdef1e3
3
+ metadata.gz: 7e2683450493f7798b19ba771062b9667d36908537c4436612dbef9258161414
4
+ data.tar.gz: f81544074c92e4a243af4dc951bf5d964d4aba9cc65d41522af036c0996df8b6
5
5
  SHA512:
6
- metadata.gz: 3ea998353b0bc33a8cf03f7b11ea719512306453b7be9f98faf4c2a378d78b3986505027dc812dd4dc9ea27e5d966def5150d34183d5e86762178a711e02c9ef
7
- data.tar.gz: f9a5a6a6705590a1445f26e6897a1ba59dda0719023f970deb826195675616e46dc227b49160ae0c26c4548dda3cb8c9fc0151304955fea1aeb3ccf7bab7cf0d
6
+ metadata.gz: c2f5d961735d863b384f0ce5fdbb725db03100b9e4c63745a5b24284847ed7ca1f3fe78007edaaa176ab9a0719ce79c0fce782b0702adcf6c2476ef446e3cc4f
7
+ data.tar.gz: 0d8994218cae5d726d355fd7a7a4b4c7b2034d8b35e561c0eff75e28e8ff095c11aefff2dd499ad2b5ecfad418707ba0917c0ddfd297405a84ebd78b15c7a3dd
@@ -22,21 +22,18 @@
22
22
 
23
23
  require_relative 'writable'
24
24
 
25
- require 'forwardable'
26
-
27
25
  module Async
28
26
  module HTTP
29
27
  module Body
30
28
  class Pipe
31
- extend Forwardable
32
-
29
+ # If the input stream is closed first, it's likely the output stream will also be closed.
33
30
  def initialize(input, output = Writable.new, task: Task.current)
34
31
  @input = input
35
32
  @output = output
36
33
 
37
34
  head, tail = IO::Socket.pair(Socket::AF_UNIX, Socket::SOCK_STREAM)
38
35
 
39
- @head = Async::IO::Stream.new(head)
36
+ @head = IO::Stream.new(head)
40
37
  @tail = tail
41
38
 
42
39
  @reader = nil
@@ -90,6 +87,7 @@ module Async
90
87
  end
91
88
  ensure
92
89
  @writer = nil
90
+
93
91
  @output.close($!)
94
92
 
95
93
  @head.close if @reader.nil?
@@ -92,9 +92,9 @@ module Async
92
92
  @stream.flush
93
93
  end
94
94
 
95
- def read_in_background(task: Task.current)
96
- task.async do |nested_task|
97
- nested_task.annotate("#{version} reading data for #{self.class}.")
95
+ def read_in_background(parent: Task.current)
96
+ parent.async do |task|
97
+ task.annotate("#{version} reading data for #{self.class}.")
98
98
 
99
99
  begin
100
100
  while !self.closed?
@@ -104,7 +104,10 @@ module Async
104
104
  rescue IOError, EOFError, Errno::ECONNRESET, Errno::EPIPE, Async::Wrapper::Cancelled
105
105
  # Ignore.
106
106
  ensure
107
- close($!)
107
+ # Don't call #close twice.
108
+ if @reader
109
+ self.close($!)
110
+ end
108
111
  end
109
112
  end
110
113
  end
@@ -71,10 +71,15 @@ module Async
71
71
  end
72
72
  end
73
73
 
74
+ # This method should only be called from within the context of the output task.
74
75
  def close(error = nil)
75
- @stream.finish_output(error)
76
+ if @stream
77
+ @stream.finish_output(error)
78
+ @stream = nil
79
+ end
76
80
  end
77
81
 
82
+ # This method should only be called from within the context of the HTTP/2 stream.
78
83
  def stop(error)
79
84
  @task&.stop
80
85
  @task = nil
@@ -103,7 +108,7 @@ module Async
103
108
  # GC.start
104
109
  end
105
110
 
106
- @stream.finish_output
111
+ self.close
107
112
  ensure
108
113
  @body&.close($!)
109
114
  @body = nil
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Async
24
24
  module HTTP
25
- VERSION = "0.50.10"
25
+ VERSION = "0.50.11"
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.50.10
4
+ version: 0.50.11
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-04-01 00:00:00.000000000 Z
11
+ date: 2020-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -284,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
284
  - !ruby/object:Gem::Version
285
285
  version: '0'
286
286
  requirements: []
287
- rubygems_version: 3.0.6
287
+ rubygems_version: 3.1.2
288
288
  signing_key:
289
289
  specification_version: 4
290
290
  summary: A HTTP client and server library.