diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-08-18 16:19:56 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-08-18 16:19:56 +0900 |
commit | b77ea0d82a53caa80b85872ff59053bc7e0eb9b8 (patch) | |
tree | ebcb7f426c23dcfd23ce63308e94ed190f77f344 | |
parent | ec059733e3e63ac461e8477638ad5d0a7d65dc58 (diff) | |
download | plum-b77ea0d82a53caa80b85872ff59053bc7e0eb9b8.tar.gz |
connection: callback :negotiated in receive_settings
-rw-r--r-- | lib/plum/connection.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/plum/connection.rb b/lib/plum/connection.rb index 2597790..e426853 100644 --- a/lib/plum/connection.rb +++ b/lib/plum/connection.rb @@ -109,10 +109,8 @@ module Plum end def validate_received_frame(frame) - if @state == :waiting_settings - raise ConnectionError.new(:protocol_error) if frame.type != :settings - @state = :open - callback(:negotiated) + if @state == :waiting_settings && frame.type != :settings + raise ConnectionError.new(:protocol_error) end if @state == :waiting_continuation @@ -189,6 +187,11 @@ module Plum callback(:remote_settings, @remote_settings, old_remote_settings) send_immediately Frame.settings(:ack) if send_ack + + if @state == :waiting_settings + @state = :open + callback(:negotiated) + end end def apply_remote_settings(old_remote_settings) |