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/client/connection.rb | |
parent | dc870b7b2e8da6f96c3e5141d0341d5a29ca38f4 (diff) | |
download | plum-b33d179b001119155d4dc0bd8dc43a18a29cfaa9.tar.gz |
connection: fix stream id managing
Diffstat (limited to 'lib/plum/client/connection.rb')
-rw-r--r-- | lib/plum/client/connection.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/plum/client/connection.rb b/lib/plum/client/connection.rb index bab2dc0..8721fb5 100644 --- a/lib/plum/client/connection.rb +++ b/lib/plum/client/connection.rb @@ -12,10 +12,9 @@ module Plum # Create a new stream for HTTP request. # @param args [Hash] the argument for Stream.new - def open_stream(**args) - next_id = @max_odd_stream_id > 0 ? @max_odd_stream_id + 2 : 1 - stream = new_stream(next_id, **args) - stream + def open_stream + next_id = @max_stream_id + (@max_stream_id.even? ? 1 : 2) + stream(next_id) end end end |