async-http 0.30.3 → 0.30.4

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: 063a701b5810c3425ab42fef84e971b8f0c916c0b4ad55cf305b5385850cc6de
4
- data.tar.gz: 32daee0cf2ca5a488e6e33308a1b7c9f953feafed4111d1e82b6212790570d6c
3
+ metadata.gz: 988a06a8b08c2251198294138b4bd8a8ef679bf072633b0db804abb3b80424c8
4
+ data.tar.gz: a923e52d7d7c4b38c32e7db4a49867daad1a6e0d3393fcd524a615f793ebcc95
5
5
  SHA512:
6
- metadata.gz: '089514e5e4d794709be2fa407fd8dba4b39e8a3ac309591a238737ad0b267e84c2be525bb6532981c0844a226f6ec5a3433b717bae74e4eb95b10117f0264ec3'
7
- data.tar.gz: d96035f10d063da6ce0f16086aaa67baaabdd5aec2c733ec8b770af7012bf9b3992060b704e6b8b62f129ef26b92cf246cec1d447386b54cb3bb7cb9c0f81a5d
6
+ metadata.gz: c03b5e2b487e5071447db19ebb738986a434e121fb26d98676ffd262262682d63e612963ba46b4716de649a3558ea843f92dd2fcceef721d499759343450f077
7
+ data.tar.gz: 1191e5d82efd60553715e771cf13ddca15348dc7b241ecae2ba546147b6ca344518fef3588203f55f35e3b35886ac6049c1bef5b1e916e37a3c23112073c61bd
@@ -47,16 +47,23 @@ module Async
47
47
  @reader ||= read_in_background
48
48
  end
49
49
 
50
+ def stop_connection
51
+ @reader = nil
52
+ end
53
+
50
54
  def read_in_background(task: Task.current)
51
55
  task.async do |nested_task|
52
56
  nested_task.annotate("#{version} reading data")
53
57
 
54
58
  begin
55
- while !self.closed?
59
+ # Even thought the connection might be logically closed, we are not done until all HTTP/2 streams are closed or the underlying I/O is closed.
60
+ while !@stream.closed?
56
61
  self.read_frame
57
62
  end
58
63
  rescue
59
64
  Async.logger.debug(self) {$!}
65
+ ensure
66
+ stop_connection
60
67
  end
61
68
  end
62
69
  end
@@ -67,7 +74,6 @@ module Async
67
74
 
68
75
  attr :count
69
76
 
70
- # Only one simultaneous connection at a time.
71
77
  def multiplex
72
78
  @remote_settings.maximum_concurrent_streams
73
79
  end
@@ -47,7 +47,13 @@ module Async
47
47
  return request.stream
48
48
  end
49
49
 
50
- def receive_requests(task: Task.current)
50
+ def stop_connection
51
+ super
52
+
53
+ @requests.enqueue nil
54
+ end
55
+
56
+ def receive_requests
51
57
  while request = @requests.dequeue
52
58
  @count += 1
53
59
 
@@ -56,6 +62,7 @@ module Async
56
62
  response = yield(request)
57
63
  rescue
58
64
  request.stream.send_reset_stream(::HTTP::Protocol::HTTP2::INTERNAL_ERROR)
65
+
59
66
  Async.logger.error(request) {$!}
60
67
  else
61
68
  request.send_response(response)
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module HTTP
23
- VERSION = "0.30.3"
23
+ VERSION = "0.30.4"
24
24
  end
25
25
  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.30.3
4
+ version: 0.30.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-09 00:00:00.000000000 Z
11
+ date: 2018-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async