diff --git a/net/grpc/gateway/codec/grpc_decoder.cc b/net/grpc/gateway/codec/grpc_decoder.cc index 60e6904..b0a240d 100644 --- a/net/grpc/gateway/codec/grpc_decoder.cc +++ b/net/grpc/gateway/codec/grpc_decoder.cc @@ -15,7 +15,7 @@ GrpcDecoder::GrpcDecoder() GrpcDecoder::~GrpcDecoder() {} Status GrpcDecoder::Decode() { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_core::ExecCtx exec_ctx; for (const Slice& slice : *inputs()) { if (slice.size() == 0) { continue; @@ -32,7 +32,7 @@ Status GrpcDecoder::Decode() { Status status(StatusCode::INVALID_ARGUMENT, Format("Receives invalid compressed flag: %c.", c)); DEBUG("%s", status.error_message().c_str()); - grpc_exec_ctx_finish(&exec_ctx); + return status; } compressed_flag_ = c; @@ -85,11 +85,11 @@ Status GrpcDecoder::Decode() { grpc_slice_buffer output; grpc_slice_buffer_init(&output); if (grpc_msg_decompress( - &exec_ctx, grpc_compression_algorithm::GRPC_COMPRESS_GZIP, - &input, &output) != 1) { + grpc_compression_algorithm::GRPC_COMPRESS_GZIP, &input, + &output) != 1) { grpc_slice_buffer_destroy(&input); grpc_slice_buffer_destroy(&output); - grpc_exec_ctx_finish(&exec_ctx); + return Status(StatusCode::INTERNAL, "Failed to uncompress the GRPC data frame."); } @@ -115,7 +115,7 @@ Status GrpcDecoder::Decode() { } } inputs()->clear(); - grpc_exec_ctx_finish(&exec_ctx); + return Status::OK; } } // namespace gateway diff --git a/net/grpc/gateway/runtime/grpc_event_queue.cc b/net/grpc/gateway/runtime/grpc_event_queue.cc index aaf3064..907dd2b 100644 --- a/net/grpc/gateway/runtime/grpc_event_queue.cc +++ b/net/grpc/gateway/runtime/grpc_event_queue.cc @@ -20,7 +20,8 @@ GrpcEventQueue::~GrpcEventQueue() {} void GrpcEventQueue::Start() { gpr_thd_options thread_options = gpr_thd_options_default(); gpr_thd_options_set_joinable(&thread_options); - int ret = gpr_thd_new(&thread_id_, ExecuteEventLoop, this, &thread_options); + int ret = gpr_thd_new(&thread_id_, "grpc_event_queue", ExecuteEventLoop, this, + &thread_options); INFO("GRPC event thread started: %d", ret); }