aboutsummaryrefslogtreecommitdiffstats
path: root/lib/plum/server/connection.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-11-04 00:57:02 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-11-04 00:57:02 +0900
commitb33d179b001119155d4dc0bd8dc43a18a29cfaa9 (patch)
tree580869fe3642ce637717386ef324680f0e8669ac /lib/plum/server/connection.rb
parentdc870b7b2e8da6f96c3e5141d0341d5a29ca38f4 (diff)
downloadplum-b33d179b001119155d4dc0bd8dc43a18a29cfaa9.tar.gz
connection: fix stream id managing
Diffstat (limited to 'lib/plum/server/connection.rb')
-rw-r--r--lib/plum/server/connection.rb6
1 files changed, 4 insertions, 2 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