10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/protobuf/rpc/servers/evented_runner.rb', line 10
def self.run(server)
EventMachine.error_handler do |error|
if error.message == 'no acceptor'
raise 'Failed binding to %s:%d (%s)' % [server.host, server.port, error.message]
else
Protobuf::Logger.error error.message
Protobuf::Logger.error error.backtrace.join("\n")
end
end
EM.schedule do
EventMachine.start_server(server.host, server.port, Protobuf::Rpc::EventedServer) && \
Protobuf::Logger.info('RPC Server listening at %s:%d in %s' % [server.host, server.port, server.env])
end
EM.reactor_running? ? EM.reactor_thread.join : EM.run
end
|