Class: Vines::Stream::Server::Outbound::TLSResult

Inherits:
Vines::Stream::State show all
Defined in:
lib/vines/stream/server/outbound/tls_result.rb

Constant Summary collapse

NS =
NAMESPACES[:tls]
PROCEED =
'proceed'.freeze
FAILURE =
'failure'.freeze

Constants inherited from Vines::Stream::State

Vines::Stream::State::BODY, Vines::Stream::State::STREAM

Instance Attribute Summary

Attributes inherited from Vines::Stream::State

#stream

Instance Method Summary collapse

Methods inherited from Vines::Stream::State

#==, #eql?, #hash

Methods included from Log

#log

Constructor Details

#initialize(stream, success = AuthRestart) ⇒ TLSResult

Returns a new instance of TLSResult.



12
13
14
# File 'lib/vines/stream/server/outbound/tls_result.rb', line 12

def initialize(stream, success=AuthRestart)
  super
end

Instance Method Details

#node(node) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/vines/stream/server/outbound/tls_result.rb', line 16

def node(node)
  raise StreamErrors::NotAuthorized unless namespace(node) == NS
  case node.name
  when PROCEED
    stream.encrypt
    stream.start(node)
    stream.reset
    advance
  when FAILURE
    stream.close_connection
  else
    raise StreamErrors::NotAuthorized
  end
end