Sha256: 0169ddf419ca5271f992b782bbdc903f0e77a05e24f67657a5908f31d563ed85

Contents?: true

Size: 658 Bytes

Versions: 4

Compression:

Stored size: 658 Bytes

Contents

# Stolen from Thin

class UState::Server
  class Backends::TCP < Backends::Base
    require 'socket'
   
    attr_accessor :host, :port

    HOST = '127.0.0.1'
    PORT = 55956

    def initialize(opts = {})
      @host = opts[:host] || HOST
      @port = opts[:port] || PORT
      super opts
    end

    # Connect the server
    def connect
      @server.log.info "Listening on #{@host}:#{@port}"
      @signature = EventMachine.start_server(@host, @port, Connection, &method(:initialize_connection))
    end

    # Stops server
    def disconnect
      EventMachine.stop_server @signature
    end

    def to_s
      "#{@host}:#{@port}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ustate-client-0.0.8 lib/ustate/server/backends/tcp.rb
ustate-client-0.0.7 lib/ustate/server/backends/tcp.rb
ustate-client-0.0.6 lib/ustate/server/backends/tcp.rb
ustate-client-0.0.5 lib/ustate/server/backends/tcp.rb