Class: TUB::UpgradableTcpServer

Inherits:
Thin::Backends::TcpServer
  • Object
show all
Defined in:
lib/tub/upgradable_tcp_server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port, options) ⇒ UpgradableTcpServer

Thin::Server assumes we’ll have options



47
48
49
50
51
52
# File 'lib/tub/upgradable_tcp_server.rb', line 47

def initialize(host, port, options)
  super(host, port)
  UpgradableConnection.initial_handler_class = Thin::Connection
  raise ":handler_on_upgrade must be provided" unless options[:handler_on_upgrade]
  UpgradableConnection.upgraded_handler_class = options[:handler_on_upgrade]
end

Instance Attribute Details

#sslObject

Returns the value of attribute ssl.



45
46
47
# File 'lib/tub/upgradable_tcp_server.rb', line 45

def ssl
  @ssl
end

Instance Method Details

#connectObject

Connect the server



55
56
57
# File 'lib/tub/upgradable_tcp_server.rb', line 55

def connect
  @signature = EventMachine.start_server(@host, @port, UpgradableConnection, &method(:initialize_connection))
end