Class: Fenris::ProviderServer

Inherits:
Connection
  • Object
show all
Defined in:
lib/fenris/connection.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Connection

#initialize, #log, mkbinding, #proxy, #proxy_target_unbound, #push, #receive_data, #ssl_verify_peer, #unbind

Constructor Details

This class inherits a constructor from Fenris::Connection

Class Method Details

.begin(client, provider_binding, local_binding) ⇒ Object



75
76
77
78
79
80
# File 'lib/fenris/connection.rb', line 75

def self.begin(client, provider_binding, local_binding)
  client.log "Serving port #{local_binding} on #{provider_binding}"
  server_em = mkbinding(:start_server, provider_binding)
  local_em = mkbinding(:connect, local_binding)
  EventMachine::__send__ *server_em, self, client, :peer_binding => local_em, :binding => server_em
end

Instance Method Details

#post_initObject



82
83
84
85
# File 'lib/fenris/connection.rb', line 82

def post_init
  log "New connection - begin ssl handshake"
  start_tls :private_key_file => @client.my_key_path, :cert_chain_file => @client.my_cert_path, :verify_peer => true
end

#ssl_handshake_completedObject



87
88
89
90
# File 'lib/fenris/connection.rb', line 87

def ssl_handshake_completed
  log "SSL complete - open local connection"
  EventMachine::__send__ *@peer_binding, ProviderLocal, @client, :peer => self, :binding => @peer_binding
end