protocol-http2 0.16.0 → 0.17.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: 9b04aa8b3ac2dcabc6345c950831b612f2343244a17655cb955f668d91f427dd
4
- data.tar.gz: 3796185ba4e59277d08683ee2e80ffab91c9efa8fb24b4cfbc7c69ba8beb7995
3
+ metadata.gz: 20ea1a9636c45a186fe714ec65ae7160bca6d76b2629416bce0b42940e35a8d6
4
+ data.tar.gz: 2197763799c0b2e70b24b0f95b10e1eeef2831a540346d65ca71334bdc83615e
5
5
  SHA512:
6
- metadata.gz: 44c60b4ceeb39e553ed362c117bc518a7a19106436fe006b191b94128deff6c7ca2f7433c0e78c1c4b86925dd5ab662cb7b221e8dd46806dabb4c8f3aae76d1f
7
- data.tar.gz: d66e9905d31273733764cbf7ee6514a089e010e3afc45816aec0e1e993dbc0cb495c5144c89afec03f83f54d30a746a437eb78cdb57336f9c97455a0e75c9ee3
6
+ metadata.gz: 9d853eadb2b0bdac2940bf4338c6afd2376e2857c1516d9306736792122ff0a8409ac906e77e16c5c465e85f018365c184a03de6f6d7631181ecde6322328f71
7
+ data.tar.gz: f989baa4230ebc3d511ee5a49836e3c794b7a6eba01e309b33471fe73effc4354c4e0929bc86a770f19663585e8d252942b184d4cda8d85d779e28babc0be5e5
checksums.yaml.gz.sig CHANGED
Binary file
@@ -143,9 +143,14 @@ module Protocol
143
143
  end
144
144
  end
145
145
 
146
+ def synchronize
147
+ yield
148
+ end
149
+
146
150
  # Reads one frame from the network and processes. Processing the frame updates the state of the connection and related streams. If the frame triggers an error, e.g. a protocol error, the connection will typically emit a goaway frame and re-raise the exception. You should continue processing frames until the underlying connection is closed.
147
151
  def read_frame
148
152
  frame = @framer.read_frame(@local_settings.maximum_frame_size)
153
+
149
154
  # puts "#{self.class} #{@state} read_frame: class=#{frame.class} stream_id=#{frame.stream_id} flags=#{frame.flags} length=#{frame.length} (remote_stream_id=#{@remote_stream_id})"
150
155
  # puts "Windows: local_window=#{@local_window.inspect}; remote_window=#{@remote_window.inspect}"
151
156
 
@@ -207,11 +212,21 @@ module Protocol
207
212
  end
208
213
 
209
214
  def write_frame(frame)
210
- @framer.write_frame(frame)
215
+ synchronize do
216
+ @framer.write_frame(frame)
217
+ @framer.flush
218
+ end
211
219
  end
212
220
 
213
221
  def write_frames
214
- yield @framer
222
+ if @framer
223
+ synchronize do
224
+ yield @framer
225
+ @framer.flush
226
+ end
227
+ else
228
+ raise EOFError, "Connection closed!"
229
+ end
215
230
  end
216
231
 
217
232
  def update_local_settings(changes)
@@ -41,6 +41,10 @@ module Protocol
41
41
  @frames = frames
42
42
  end
43
43
 
44
+ def flush
45
+ @stream.flush
46
+ end
47
+
44
48
  def close
45
49
  @stream.close
46
50
  end
@@ -69,7 +73,7 @@ module Protocol
69
73
  # Read the header:
70
74
  length, type, flags, stream_id = read_header
71
75
 
72
- # Async.logger.debug(self) {"read_frame: length=#{length} type=#{type} flags=#{flags} stream_id=#{stream_id} -> klass=#{@frames[type].inspect}"}
76
+ # Console.debug(self) {"read_frame: length=#{length} type=#{type} flags=#{flags} stream_id=#{stream_id} -> klass=#{@frames[type].inspect}"}
73
77
 
74
78
  # Allocate the frame:
75
79
  klass = @frames[type] || Frame
@@ -78,19 +82,19 @@ module Protocol
78
82
  # Read the payload:
79
83
  frame.read(@stream, maximum_frame_size)
80
84
 
81
- # Async.logger.debug(self, name: "read") {frame.inspect}
85
+ # Console.debug(self, name: "read") {frame.inspect}
82
86
 
83
87
  return frame
84
88
  end
85
89
 
90
+ # Write a frame to the underlying IO.
91
+ # After writing one or more frames, you should call flush to ensure the frames are sent to the remote peer.
92
+ # @parameter frame [Frame] the frame to write.
86
93
  def write_frame(frame)
87
- # Async.logger.debug(self, name: "write") {frame.inspect}
94
+ # Console.debug(self, name: "write") {frame.inspect}
88
95
 
89
96
  frame.write(@stream)
90
97
 
91
- # Don't call @stream.flush here because it can cause significant contention if there is a semaphore around this method.
92
- # @stream.flush
93
-
94
98
  return frame
95
99
  end
96
100
 
@@ -31,7 +31,9 @@ module Protocol
31
31
  send_settings(settings)
32
32
 
33
33
  read_frame do |frame|
34
- raise ProtocolError, "First frame must be #{SettingsFrame}, but got #{frame.class}" unless frame.is_a? SettingsFrame
34
+ unless frame.is_a? SettingsFrame
35
+ raise ProtocolError, "First frame must be #{SettingsFrame}, but got #{frame.class}"
36
+ end
35
37
  end
36
38
  else
37
39
  raise ProtocolError, "Cannot read connection preface in state #{@state}"
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP2
8
- VERSION = "0.16.0"
8
+ VERSION = "0.17.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: protocol-http2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -40,7 +40,7 @@ cert_chain:
40
40
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
41
41
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
42
42
  -----END CERTIFICATE-----
43
- date: 2024-01-26 00:00:00.000000000 Z
43
+ date: 2024-04-21 00:00:00.000000000 Z
44
44
  dependencies:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: protocol-hpack
metadata.gz.sig CHANGED
Binary file