Sha256: 82a01b1a6c62ba9c65dee0fff08a4f56535466129d7e9380688d0b821ae5374a

Contents?: true

Size: 432 Bytes

Versions: 2

Compression:

Stored size: 432 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|
        blk.call(c)
      end
    end
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-proxy-0.1.3 lib/em-proxy/proxy.rb
em-proxy-0.1.2 lib/em-proxy/proxy.rb