diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-11-04 00:57:02 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-11-04 00:57:02 +0900 |
commit | b33d179b001119155d4dc0bd8dc43a18a29cfaa9 (patch) | |
tree | 580869fe3642ce637717386ef324680f0e8669ac /lib/plum/server | |
parent | dc870b7b2e8da6f96c3e5141d0341d5a29ca38f4 (diff) | |
download | plum-b33d179b001119155d4dc0bd8dc43a18a29cfaa9.tar.gz |
connection: fix stream id managing
Diffstat (limited to 'lib/plum/server')
-rw-r--r-- | lib/plum/server/connection.rb | 6 | ||||
-rw-r--r-- | lib/plum/server/http_connection.rb | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/plum/server/connection.rb b/lib/plum/server/connection.rb index c12ef00..450dcf6 100644 --- a/lib/plum/server/connection.rb +++ b/lib/plum/server/connection.rb @@ -11,8 +11,10 @@ module Plum # Reserves a new stream to server push. # @param args [Hash] The argument to pass to Stram.new. def reserve_stream(**args) - next_id = @max_even_stream_id + 2 - stream = new_stream(next_id, state: :reserved_local, **args) + next_id = @max_stream_id + (@max_stream_id.odd? ? 1 : 2) + stream = stream(next_id) + stream.set_state(:reserved_local) + stream.update_dependency(**args) stream end diff --git a/lib/plum/server/http_connection.rb b/lib/plum/server/http_connection.rb index 0e9462c..7111bb4 100644 --- a/lib/plum/server/http_connection.rb +++ b/lib/plum/server/http_connection.rb @@ -70,7 +70,7 @@ module Plum def process_first_request encoder = HPACK::Encoder.new(0, indexing: false) # don't pollute connection's HPACK context - stream = new_stream(1) + stream = stream(1) max_frame_size = local_settings[:max_frame_size] headers = @_headers.merge({ ":method" => @_http_parser.http_method, ":path" => @_http_parser.request_url, |