Skip to content

Commit

Permalink
handle the case when bool ok = false on buf read in generic grpc service
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravi Nagarjun Akella authored and Ravi Nagarjun Akella committed Jul 12, 2024
1 parent 4e31b26 commit 0ddc24e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class SISLConan(ConanFile):
name = "sisl"
version = "12.2.3"
version = "12.2.4"

homepage = "https://github.com/eBay/sisl"
description = "Library for fast data structures, utilities"
Expand Down
2 changes: 1 addition & 1 deletion include/sisl/grpc/generic_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class GenericRpcData : public RpcDataAbstract, sisl::ObjLifeCounter< GenericRpcD
bool do_authorization();

RpcDataAbstract* on_request_received(bool ok);
RpcDataAbstract* on_buf_read(bool);
RpcDataAbstract* on_buf_read(bool ok);
RpcDataAbstract* on_buf_write(bool);
RpcDataAbstract* on_request_completed(bool);

Expand Down
16 changes: 9 additions & 7 deletions src/grpc/generic_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ RpcDataAbstract* GenericRpcData::on_request_received(bool ok) {
return in_shutdown ? nullptr : create_new();
}

RpcDataAbstract* GenericRpcData::on_buf_read(bool) {
auto this_rpc_data = boost::intrusive_ptr< GenericRpcData >{this};
// take a ref before the handler cb is called.
// unref is called in send_response which is handled by us (in case of sync calls)
// or by the handler (for async calls)
ref();
if (RPCHelper::run_generic_handler_cb(m_rpc_info->m_server, m_ctx.method(), this_rpc_data)) { send_response(); }
RpcDataAbstract* GenericRpcData::on_buf_read(bool ok) {
if (ok) {
auto this_rpc_data = boost::intrusive_ptr< GenericRpcData >{this};
// take a ref before the handler cb is called.
// unref is called in send_response which is handled by us (in case of sync calls)
// or by the handler (for async calls)
ref();
if (RPCHelper::run_generic_handler_cb(m_rpc_info->m_server, m_ctx.method(), this_rpc_data)) { send_response(); }
}
return nullptr;
}

Expand Down

0 comments on commit 0ddc24e

Please sign in to comment.