Class: Thin::SwiftiplyConnection

### Home Classes Methods

### In Files

- lib/thin/backends/swiftiply_client.rb

### Parent

Connection

### Methods

- #connection_completed
- #host_ip
- #persistent?
- #swiftiply_handshake
- #unbind

### Class/Module Index

Quicksearch

- Thin
- Thin::Backends
- Thin::Backends::Base
- Thin::Backends::SwiftiplyClient
- Thin::Backends::TcpServer
- Thin::Backends::UnixServer
- Thin::Command
- Thin::Connection
- Thin::Controllers
- Thin::Controllers::Cluster
- Thin::Controllers::Controller
- Thin::Controllers::Service
- Thin::Daemonizable
- Thin::Daemonizable::ClassMethods
- Thin::Headers
- Thin::InvalidOption
- Thin::InvalidRequest
- Thin::Logging
- Thin::Logging::SimpleFormatter
- Thin::OptionRequired
- Thin::PidFileExist
- Thin::PidFileNotFound
- Thin::PlatformNotSupported
- Thin::Request
- Thin::Response
- Thin::RestartTimeout
- Thin::Runner
- Thin::RunnerError
- Thin::Server
- Thin::Stats
- Thin::Stats::Adapter
- Thin::SwiftiplyConnection
- Thin::UnixConnection
- Rack
- Rack::Adapter
- Rack::Adapter::Rails
- Rack::Adapter::Rails::CGIWrapper
- Rack::Adapter::Rails::CgiApp
- Rack::AdapterNotFound
- Process

No matching classes.

# Thin::SwiftiplyConnection

### Public Instance Methods

connection_completed() click to toggle source

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

persistent?() click to toggle source

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

unbind() click to toggle source

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

### Protected Instance Methods

host_ip() click to toggle source

For some reason Swiftiply request the current host

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

swiftiply_handshake(key) click to toggle source

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.