Sha256: 50de05005a1da458a44d8e55f5abcb575fff421b1eb7f498fa94a6e67662642a

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

class Proxy

  def self.start(options, &blk)
    EM.epoll
    EM.run do

      trap("TERM") { stop }
      trap("INT")  { stop }

      EventMachine::start_server(options[:host], options[:port],
                                 EventMachine::ProxyServer::Connection, options) do |c|
        c.instance_eval(&blk)
      end
    end
  end

  def self.stop
    puts "Terminating ProxyServer"
    EventMachine.stop
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-proxy-0.1.1 lib/em-proxy/proxy.rb