Class: Protobuf::Rpc::EventedServer
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- Protobuf::Rpc::EventedServer
- Includes:
- Logger::LogMethods, Server
- Defined in:
- lib/protobuf/rpc/servers/evented_server.rb
Instance Method Summary collapse
-
#post_init ⇒ Object
Initialize a new read buffer for storing client request info.
-
#receive_data(data) ⇒ Object
Receive a chunk of data, potentially flushed to handle_client.
Methods included from Server
#handle_client, #handle_error, #invoke_rpc_method, #log_signature, #parse_request_from_buffer, #parse_response_from_service, #parse_service_info, #send_response, #serialize_response
Instance Method Details
#post_init ⇒ Object
Initialize a new read buffer for storing client request info
10 11 12 13 14 15 16 17 |
# File 'lib/protobuf/rpc/servers/evented_server.rb', line 10 def post_init log_debug '[server] Post init, new read buffer created' @stats = Protobuf::Rpc::Stat.new(:SERVER, true) @stats.client = Socket.unpack_sockaddr_in(get_peername) @buffer = Protobuf::Rpc::Buffer.new(:read) @did_respond = false end |
#receive_data(data) ⇒ Object
Receive a chunk of data, potentially flushed to handle_client
20 21 22 23 24 |
# File 'lib/protobuf/rpc/servers/evented_server.rb', line 20 def receive_data(data) log_debug '[server] receive_data: %s' % data @buffer << data handle_client if @buffer.flushed? end |