Sha256: 1f800f98000b628d44c0221253cda8d15838f7452664c4dee64053e00fe18225

Contents?: true

Size: 399 Bytes

Versions: 1

Compression:

Stored size: 399 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) 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
fizx-em-proxy-0.1.1 lib/em-proxy/proxy.rb