Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/http/2/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def new_stream(**args)
connection_error(:protocol_error, msg: "id is smaller than previous") if @stream_id < @last_stream_id

stream = activate_stream(id: @stream_id, **args)
@last_stream_id = stream.id

@stream_id += 2

Expand Down Expand Up @@ -766,6 +765,7 @@ def activate_stream(id:, **args)
raise StreamLimitExceeded if @active_stream_count >= @local_settings[:settings_max_concurrent_streams]

stream = Stream.new(connection: self, id: id, **args)
@last_stream_id = id

stream.once(:close) do
@streams.delete(id)
Expand Down Expand Up @@ -799,7 +799,6 @@ def verify_stream_order(id)
return unless id.odd?

connection_error(msg: "Stream ID smaller than previous") if @last_stream_id >= id
@last_stream_id = id
end

def _verify_pseudo_headers(frame, mandatory_headers)
Expand Down
5 changes: 5 additions & 0 deletions lib/http/2/flow_buffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ def initialize
@bytesize = 0
end

def clear
@buffer.clear
@bytesize = 0
end

def <<(frame)
@buffer << frame
@bytesize += frame[:payload].bytesize
Expand Down
2 changes: 2 additions & 0 deletions sig/frame_buffer.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ module HTTP2

@buffer: Array[data_frame]

def clear: () -> void

def <<: (data_frame frame) -> void

def empty?: () -> bool
Expand Down
Loading