aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-01-17 17:22:53 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-01-17 17:22:53 +0900
commit572c3283b2ca5b68bb69c4063e28f525bc5c7702 (patch)
tree04f077d858876830e942b51863f093fcb38eac42
parent34e727b625b0439817acdc4d052170c8e9115f59 (diff)
downloadplum-572c3283b2ca5b68bb69c4063e28f525bc5c7702.tar.gz
stream: fix Stream Dependency field handling
-rw-r--r--lib/plum/stream.rb6
-rw-r--r--test/plum/stream/test_handle_frame.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/plum/stream.rb b/lib/plum/stream.rb
index 4cb2285..85fe311 100644
--- a/lib/plum/stream.rb
+++ b/lib/plum/stream.rb
@@ -221,11 +221,11 @@ module Plum
def receive_priority_payload(payload)
esd = payload.uint32
- e = esd >> 31
- dependency_id = e & ~(1 << 31)
+ e = (esd >> 31) == 1
+ dependency_id = esd & ~(1 << 31)
weight = payload.uint8(4)
- update_dependency(weight: weight, parent: @connection.streams[dependency_id], exclusive: e == 1)
+ update_dependency(weight: weight, parent: @connection.streams[dependency_id], exclusive: e)
end
def receive_rst_stream(frame)
diff --git a/test/plum/stream/test_handle_frame.rb b/test/plum/stream/test_handle_frame.rb
index 6a062cf..b4b4a4c 100644
--- a/test/plum/stream/test_handle_frame.rb
+++ b/test/plum/stream/test_handle_frame.rb
@@ -192,7 +192,7 @@ class StreamHandleFrameTest < Minitest::Test
def test_stream_handle_priority_self_depend
open_server_connection {|con|
stream = open_new_stream(con)
- payload = "".push_uint32((1 << 31) | stream.id).push_uint8(6)
+ payload = "".push_uint32((0 << 31) | stream.id).push_uint8(6)
stream.receive_frame(Frame.new(type: :priority,
stream_id: stream.id,
payload: payload))