Class: Thin::SwiftiplyConnection

Class Thin::SwiftiplyConnection < Connection

(in files lib/thin/backends/swiftiply_client.rb )

Raised when a mandatory option is missing to run a command.

Includes

Methods

Public Instance connection_completed()

    # File lib/thin/backends/swiftiply_client.rb, line 33
33:     def connection_completed
34:       send_data swiftiply_handshake(@backend.key)
35:     end

Public Instance persistent?()

    # File lib/thin/backends/swiftiply_client.rb, line 37
37:     def persistent?
38:       true
39:     end

Public Instance unbind()

    # File lib/thin/backends/swiftiply_client.rb, line 41
41:     def unbind
42:       super
43:       EventMachine.add_timer(rand(2)) { reconnect(@backend.host, @backend.port) } if @backend.running?
44:     end

Protected Instance host_ip()

For some reason Swiftiply request the current host

    # File lib/thin/backends/swiftiply_client.rb, line 52
52:       def host_ip
53:         Socket.gethostbyname(@backend.host)[3].unpack('CCCC') rescue [0,0,0,0]
54:       end

Protected Instance swiftiply_handshake(key)

    # File lib/thin/backends/swiftiply_client.rb, line 47
47:       def swiftiply_handshake(key)
48:         'swiftclient' << host_ip.collect { |x| sprintf('%02x', x.to_i)}.join << sprintf('%04x', @backend.port) << sprintf('%02x', key.length) << key
49:       end