Sha256: ad7866dc64b2656183b147731c5782bf3777af5deef5dcb808321e1ca40237fa

Contents?: true

Size: 421 Bytes

Versions: 6

Compression:

Stored size: 421 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

6 entries across 6 versions & 1 rubygems

Version Path
em-proxy-0.1.9 lib/em-proxy/proxy.rb
em-proxy-0.1.8 lib/em-proxy/proxy.rb
em-proxy-0.1.7 lib/em-proxy/proxy.rb
em-proxy-0.1.6 lib/em-proxy/proxy.rb
em-proxy-0.1.5 lib/em-proxy/proxy.rb
em-proxy-0.1.4 lib/em-proxy/proxy.rb