From 572c3283b2ca5b68bb69c4063e28f525bc5c7702 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Sun, 17 Jan 2016 17:22:53 +0900 Subject: stream: fix Stream Dependency field handling --- lib/plum/stream.rb | 6 +++--- test/plum/stream/test_handle_frame.rb | 2 +- 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)) -- cgit v1.2.3