Skip to content

Commit

Permalink
Sync c-core 1.66.0-pre5
Browse files Browse the repository at this point in the history
  • Loading branch information
HannahShiSFB committed Aug 17, 2024
1 parent 842f08d commit 241b838
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 61 deletions.
2 changes: 1 addition & 1 deletion gRPC-C++.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-C++'
# TODO (mxyan): use version that match gRPC version when pod is stabilized
version = '1.66.0-pre3'
version = '1.66.0-pre5'
s.version = version
s.summary = 'gRPC C++ library'
s.homepage = 'https://grpc.io'
Expand Down
2 changes: 1 addition & 1 deletion gRPC-Core.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC-Core'
version = '1.66.0-pre3'
version = '1.66.0-pre5'
s.version = version
s.summary = 'Core cross-platform gRPC library, written in C'
s.homepage = 'https://grpc.io'
Expand Down
2 changes: 1 addition & 1 deletion gRPC-ProtoRPC.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC-ProtoRPC'
version = '1.66.0-pre3'
version = '1.66.0-pre5'
s.version = version
s.summary = 'RPC library for Protocol Buffers, based on gRPC'
s.homepage = 'https://grpc.io'
Expand Down
2 changes: 1 addition & 1 deletion gRPC-RxLibrary.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC-RxLibrary'
version = '1.66.0-pre3'
version = '1.66.0-pre5'
s.version = version
s.summary = 'Reactive Extensions library for iOS/OSX.'
s.homepage = 'https://grpc.io'
Expand Down
2 changes: 1 addition & 1 deletion gRPC.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

Pod::Spec.new do |s|
s.name = 'gRPC'
version = '1.66.0-pre3'
version = '1.66.0-pre5'
s.version = version
s.summary = 'gRPC client library for iOS/OSX'
s.homepage = 'https://grpc.io'
Expand Down
4 changes: 2 additions & 2 deletions include/grpcpp/version_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define GRPC_CPP_VERSION_MAJOR 1
#define GRPC_CPP_VERSION_MINOR 66
#define GRPC_CPP_VERSION_PATCH 0
#define GRPC_CPP_VERSION_TAG "pre3"
#define GRPC_CPP_VERSION_STRING "1.66.0-pre3"
#define GRPC_CPP_VERSION_TAG "pre5"
#define GRPC_CPP_VERSION_STRING "1.66.0-pre5"

#endif // GRPCPP_VERSION_INFO_H
18 changes: 15 additions & 3 deletions src/core/handshaker/security/secure_endpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ struct secure_endpoint : public grpc_endpoint {
}

~secure_endpoint() {
memory_owner.Reset();
tsi_frame_protector_destroy(protector);
tsi_zero_copy_grpc_protector_destroy(zero_copy_protector);
grpc_slice_buffer_destroy(&source_buffer);
Expand Down Expand Up @@ -254,6 +253,13 @@ static void on_read(void* user_data, grpc_error_handle error) {

{
grpc_core::MutexLock l(&ep->read_mu);

// If we were shut down after this callback was scheduled with OK
// status but before it was invoked, we need to treat that as an error.
if (ep->wrapped_ep == nullptr && error.ok()) {
error = absl::CancelledError("secure endpoint shutdown");
}

uint8_t* cur = GRPC_SLICE_START_PTR(ep->read_staging_buffer);
uint8_t* end = GRPC_SLICE_END_PTR(ep->read_staging_buffer);

Expand Down Expand Up @@ -380,9 +386,12 @@ static void flush_write_staging_buffer(secure_endpoint* ep, uint8_t** cur,

static void on_write(void* user_data, grpc_error_handle error) {
secure_endpoint* ep = static_cast<secure_endpoint*>(user_data);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, std::exchange(ep->write_cb, nullptr),
std::move(error));
grpc_closure* cb = ep->write_cb;
ep->write_cb = nullptr;
SECURE_ENDPOINT_UNREF(ep, "write");
grpc_core::EnsureRunInExecCtx([cb, error = std::move(error)]() {
grpc_core::Closure::Run(DEBUG_LOCATION, cb, error);
});
}

static void endpoint_write(grpc_endpoint* secure_ep, grpc_slice_buffer* slices,
Expand Down Expand Up @@ -503,7 +512,10 @@ static void endpoint_write(grpc_endpoint* secure_ep, grpc_slice_buffer* slices,

static void endpoint_destroy(grpc_endpoint* secure_ep) {
secure_endpoint* ep = reinterpret_cast<secure_endpoint*>(secure_ep);
ep->read_mu.Lock();
ep->wrapped_ep.reset();
ep->memory_owner.Reset();
ep->read_mu.Unlock();
SECURE_ENDPOINT_UNREF(ep, "destroy");
}

Expand Down
7 changes: 7 additions & 0 deletions src/core/lib/surface/call.cc
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,13 @@ void grpc_call_tracer_set(grpc_call* call,
return arena->SetContext<grpc_core::CallTracerAnnotationInterface>(tracer);
}

void grpc_call_tracer_set_and_manage(grpc_call* call,
grpc_core::ClientCallTracer* tracer) {
grpc_core::Arena* arena = grpc_call_get_arena(call);
arena->ManagedNew<ClientCallTracerWrapper>(tracer);
return arena->SetContext<grpc_core::CallTracerAnnotationInterface>(tracer);
}

void* grpc_call_tracer_get(grpc_call* call) {
grpc_core::Arena* arena = grpc_call_get_arena(call);
auto* call_tracer =
Expand Down
19 changes: 19 additions & 0 deletions src/core/lib/surface/call.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,16 @@ void grpc_call_log_batch(const char* file, int line, const grpc_op* ops,

void grpc_call_tracer_set(grpc_call* call, grpc_core::ClientCallTracer* tracer);

// Sets call tracer on the call and manages its life by using the call's arena.
// When using this API, the tracer will be destroyed by grpc_call arena when
// grpc_call is about to be destroyed. The caller of this API SHOULD NOT
// manually destroy the tracer. This API is used by Python as a way of using
// Arena to manage the lifetime of the call tracer. Python needs this API
// because the tracer was created within a separate shared object library which
// doesn't have access to core functions like arena->ManagedNew<>.
void grpc_call_tracer_set_and_manage(grpc_call* call,
grpc_core::ClientCallTracer* tracer);

void* grpc_call_tracer_get(grpc_call* call);

#define GRPC_CALL_LOG_BATCH(ops, nops) \
Expand All @@ -276,6 +286,15 @@ void* grpc_call_tracer_get(grpc_call* call);

uint8_t grpc_call_is_client(grpc_call* call);

class ClientCallTracerWrapper {
public:
explicit ClientCallTracerWrapper(grpc_core::ClientCallTracer* tracer)
: tracer_(tracer) {}

private:
std::unique_ptr<grpc_core::ClientCallTracer> tracer_;
};

// Return an appropriate compression algorithm for the requested compression \a
// level in the context of \a call.
grpc_compression_algorithm grpc_call_compression_for_level(
Expand Down
Loading

0 comments on commit 241b838

Please sign in to comment.