gRPC-haskell/examples/echo/echo-ruby/echo-server.rb
Connor Clark e4a28e9e4b High-level unregistered concurrent interface (#41)
* remove parent ptr from unregistered calls -- unneeded

* begin unregistered high level server loop

* undo changes to highlevel server, add mkConfig for unregistered server

* move call CQ create/destroy into call create/destroy

* async normal call function

* preliminary unregistered server loop for non-streaming methods

* working unregistered highlevel example

* loop counters for benchmarking

* changes for benchmarking, add ruby example server for benchmarking

* async version of withCall, refactor unregistered server loop to handle all method types

* unregistered client streaming

* add remaining streaming modes

* unregistered server streaming test

* unregistered streaming tests

* add error logging

* fix bug in add example

* remove old TODOs

* fix bug: don't assume slices are null-terminated

* add TODO re: unregistered client streaming functions
2016-07-14 09:53:28 -07:00

26 lines
448 B
Ruby

this_dir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift(this_dir)
require 'grpc'
require 'echo_services'
$i = 0
class EchoServer < Echo::Echo::Service
def do_echo(echo_req, _unused_call)
$i = $i+1
if $i % 100 == 0
puts($i)
end
return echo_req
end
end
def main
s = GRPC::RpcServer.new
s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)
s.handle(EchoServer)
s.run_till_terminated
end
main