Sha256: c57a4ed4a2b3eaf747b6d480ee57e42e70cb6000775a763cab1322aa6fcea786

Contents?: true

Size: 823 Bytes

Versions: 4

Compression:

Stored size: 823 Bytes

Contents

require 'protobuf/rpc/server'

module Protobuf
  module Rpc
    class EventedServer < EventMachine::Connection
      include Protobuf::Rpc::Server
      include Protobuf::Logger::LogMethods
      
      # Initialize a new read buffer for storing client request info
      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 a chunk of data, potentially flushed to handle_client
      def receive_data(data)
        log_debug '[server] receive_data: %s' % data
        @buffer << data
        handle_client if @buffer.flushed?
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
protobuf-1.1.3 lib/protobuf/rpc/servers/evented_server.rb
protobuf-1.1.2 lib/protobuf/rpc/servers/evented_server.rb
protobuf-1.1.1 lib/protobuf/rpc/servers/evented_server.rb
protobuf-1.1.0.beta2 lib/protobuf/rpc/servers/evented_server.rb