Skip to content
Snippets Groups Projects
Commit 1cbeeb50 authored by Abhishek Kumar's avatar Abhishek Kumar
Browse files

Merge pull request #2336 from murgatroid99/ruby_error_codes

Made ruby server return correct error code for unimplemented method
parents 707dd2c3 f88eecd8
No related branches found
No related tags found
No related merge requests found
...@@ -398,14 +398,14 @@ module GRPC ...@@ -398,14 +398,14 @@ module GRPC
nil nil
end end
# Sends NOT_FOUND if the method can't be found # Sends UNIMPLEMENTED if the method is not implemented by this server
def found?(an_rpc) def implemented?(an_rpc)
mth = an_rpc.method.to_sym mth = an_rpc.method.to_sym
return an_rpc if rpc_descs.key?(mth) return an_rpc if rpc_descs.key?(mth)
GRPC.logger.warn("NOT_FOUND: #{an_rpc}") GRPC.logger.warn("UNIMPLEMENTED: #{an_rpc}")
noop = proc { |x| x } noop = proc { |x| x }
c = ActiveCall.new(an_rpc.call, @cq, noop, noop, an_rpc.deadline) c = ActiveCall.new(an_rpc.call, @cq, noop, noop, an_rpc.deadline)
c.send_status(StatusCodes::NOT_FOUND, '') c.send_status(StatusCodes::UNIMPLEMENTED, '')
nil nil
end end
...@@ -446,7 +446,7 @@ module GRPC ...@@ -446,7 +446,7 @@ module GRPC
an_rpc.call.run_batch(@cq, handle_call_tag, INFINITE_FUTURE, an_rpc.call.run_batch(@cq, handle_call_tag, INFINITE_FUTURE,
SEND_INITIAL_METADATA => connect_md) SEND_INITIAL_METADATA => connect_md)
return nil unless available?(an_rpc) return nil unless available?(an_rpc)
return nil unless found?(an_rpc) return nil unless implemented?(an_rpc)
# Create the ActiveCall # Create the ActiveCall
GRPC.logger.info("deadline is #{an_rpc.deadline}; (now=#{Time.now})") GRPC.logger.info("deadline is #{an_rpc.deadline}; (now=#{Time.now})")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment