lib/vines/stream/http/bind_restart.rb in vines-0.1.1 vs lib/vines/stream/http/bind_restart.rb in vines-0.2.0

- old
+ new

@@ -7,11 +7,11 @@ def initialize(stream, success=Bind) super end def node(node) - raise StreamErrors::NotAuthorized unless body?(node) && restart?(node) + raise StreamErrors::NotAuthorized unless restart?(node) doc = Document.new body = doc.create_element('body') do |el| el.add_namespace(nil, NAMESPACES[:http_bind]) el.add_namespace('stream', NAMESPACES[:stream]) @@ -24,12 +24,13 @@ end private def restart?(node) + session = stream.valid_session?(node['sid']) restart = node.attribute_with_ns('restart', NAMESPACES[:bosh]).value rescue nil - domain = node['to'] == stream.domain - domain && restart == 'true' && node['rid'] && stream.valid_session?(node['sid']) + domain = node['to'] == stream.domain + session && body?(node) && domain && restart == 'true' && node['rid'] end end end end end