Sha256: 4d4cafa5c5fd202c08b6cb4b001c2dbfdc46199ed489cfd75033fb4ba66bb3f9
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
module EventMachine module ProxyServer class Backend < EventMachine::Connection attr_accessor :plexer, :data, :name, :debug def initialize(debug = false) @debug = debug @connected = EM::DefaultDeferrable.new @data = [] end def connection_completed debug [@name, :conn_complete] @plexer.connected(@name) @connected.succeed end def receive_data(data) debug [@name, data] @data.push 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.5 | lib/em-proxy/backend.rb |
em-proxy-0.1.4 | lib/em-proxy/backend.rb |
em-proxy-0.1.3 | lib/em-proxy/backend.rb |