Sha256: a92d22a722277960794e24081a2aff5bb7e402ee75d456ddef1c12ccfda7b93b

Contents?: true

Size: 643 Bytes

Versions: 30

Compression:

Stored size: 643 Bytes

Contents

module Protobuf
  module Rpc
    class EventedRunner

      def initialize(options)
        @options = options
      end

      def run
        # Startup and run the rpc server
        ::EventMachine.schedule do
          ::EventMachine.start_server(
            @options[:host],
            @options[:port],
            ::Protobuf::Rpc::Evented::Server
          )
        end

        # Join or start the reactor
        yield if block_given?

        ::EM.reactor_running? ? ::EM.reactor_thread.join : ::EM.run
      end

      def stop
        ::EventMachine.stop_event_loop if ::EventMachine.reactor_running?
      end

    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
protobuf-2.8.0.beta5-java lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.8.0.beta5 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.8.0.beta4-java lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.8.0.beta4 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.8.0.beta3-java lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.8.0.beta3 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.8.0.beta2-java lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.8.0.beta2 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.8.0.beta1-java lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.8.0.beta1 lib/protobuf/rpc/servers/evented_runner.rb