Sha256: 2474b73adac85f623ddd045378f085c7c094c1c11b076ff3ef6cbb7cbc88639b
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
module EventMachine module ProxyServer class Backend < EventMachine::Connection attr_accessor :plexer, :name, :debug def initialize(debug = false) @debug = debug @connected = EM::DefaultDeferrable.new end def connection_completed debug [@name, :conn_complete] @plexer.connected(@name) @connected.succeed end def receive_data(data) debug [@name, data] @plexer.relay_from_backend(@name, data) end # Buffer data until the connection to the backend server # is established and is ready for use def send(data) @connected.callback { send_data data } end # Notify upstream plexer that the backend server is done # processing the request def unbind debug [@name, :unbind] @plexer.unbind_backend(@name) end private def debug(*data) return unless @debug require 'pp' pp data puts end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
em-proxy-0.1.8 | lib/em-proxy/backend.rb |
em-proxy-0.1.7 | lib/em-proxy/backend.rb |
em-proxy-0.1.6 | lib/em-proxy/backend.rb |