Class: ExperellaProxy::Backend
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- ExperellaProxy::Backend
- Includes:
- Globals
- Defined in:
- lib/experella-proxy/backend.rb
Overview
The Proxies connection to the backend server
This class will never be directly initiated by user code, but initializing gets triggered in client Connection
Instance Method Summary collapse
-
#connection_completed ⇒ Object
Called by the EventMachine loop when a remote TCP connection attempt completes successfully.
-
#receive_data(data) ⇒ Object
Called by the EventMachine loop whenever data has been received by the network connection.
-
#send(data) ⇒ Object
Buffer data for send until the connection to the backend server is established and is ready for use.
-
#unbind ⇒ Object
Notify upstream plexer that the backend server is done processing the request.
Methods included from Globals
#config, #connection_manager, #event, #logger
Instance Method Details
#connection_completed ⇒ Object
Called by the EventMachine loop when a remote TCP connection attempt completes successfully
Calls client Connection Connection#connected method
15 16 17 18 19 |
# File 'lib/experella-proxy/backend.rb', line 15 def connection_completed event(:backend_connection_complete, :name => @name) @plexer.connected(@name) @connected.succeed end |
#receive_data(data) ⇒ Object
Called by the EventMachine loop whenever data has been received by the network connection. It is never called by user code. #receive_data is called with a single parameter, a String containing the network protocol data, which may of course be binary.
Data gets passed to client Connection through Connection#relay_from_backend
28 29 30 31 |
# File 'lib/experella-proxy/backend.rb', line 28 def receive_data(data) event(:backend_receive_data, :from_backend => @name) @plexer.relay_from_backend(@name, data) end |
#send(data) ⇒ Object
Buffer data for send until the connection to the backend server is established and is ready for use.
36 37 38 39 |
# File 'lib/experella-proxy/backend.rb', line 36 def send(data) event(:backend_send_data, :data => data) @connected.callback{ send_data data } end |
#unbind ⇒ Object
Notify upstream plexer that the backend server is done processing the request
43 44 45 46 |
# File 'lib/experella-proxy/backend.rb', line 43 def unbind event(:backend_unbind, :name => @name) @plexer.unbind_backend(@name) end |