Sha256: 8c763b845b528a7ca2e59430d3d6c0748eb381857cf3c08ef89c11e8947912ba

Contents?: true

Size: 531 Bytes

Versions: 8

Compression:

Stored size: 531 Bytes

Contents

module Protobuf
  module Rpc
    class EventedRunner

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

      def self.run(server)
        # Startup and run the rpc server
        ::EventMachine.schedule do
          ::EventMachine.start_server(server.host, server.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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
protobuf-2.1.0 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.0.3 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.0.2 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.0.1 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.0.0 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.0.0.rc6 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.0.0.rc5 lib/protobuf/rpc/servers/evented_runner.rb
protobuf-2.0.0.rc4 lib/protobuf/rpc/servers/evented_runner.rb