Skip to content

Commit

Permalink
Sync c-core 1.62.0-pre1 (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
HannahShiSFB authored Feb 15, 2024
1 parent 92fb784 commit 6104cad
Show file tree
Hide file tree
Showing 81 changed files with 284 additions and 478 deletions.
3 changes: 1 addition & 2 deletions native/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ g_stands_for = "guardian" # @unused

core_version = "39.0.0" # @unused

version = "1.62.0-dev" # @unused
version = "1.62.0-pre1" # @unused

GPR_PUBLIC_HDRS = [
"include/grpc/support/alloc.h",
Expand Down Expand Up @@ -3384,7 +3384,6 @@ grpc_cc_library(
"//src/core:arena_promise",
"//src/core:closure",
"//src/core:error",
"//src/core:experiments",
"//src/core:gpr_manual_constructor",
"//src/core:httpcli_ssl_credentials",
"//src/core:iomgr_fwd",
Expand Down
4 changes: 2 additions & 2 deletions native/CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion native/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion native/REVISION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
574b0572f1dbd60d687bef3354dc1141f067b374
ef03a269f597f255d6a052ae062637717a9f4790
2 changes: 1 addition & 1 deletion native/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

# AUTO-GENERATED FROM `$REPO_ROOT/templates/_metadata.py.template`!!!

__version__ = """1.62.0.dev0"""
__version__ = """1.62.0rc1"""
11 changes: 0 additions & 11 deletions native/bazel/experiments.bzl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions native/bazel/python_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ def _generate_pb2_grpc_src_impl(context):
py_info = _merge_pyinfos(
[
p,
context.attr.grpc_library[PyInfo],
context.attr._grpc_library[PyInfo],
] + [dep[PyInfo] for dep in context.attr.py_deps],
)

runfiles = context.runfiles(files = out_files, transitive_files = py_info.transitive_sources).merge(context.attr.grpc_library[DefaultInfo].data_runfiles)
runfiles = context.runfiles(files = out_files, transitive_files = py_info.transitive_sources).merge(context.attr._grpc_library[DefaultInfo].data_runfiles)

return [
DefaultInfo(
Expand Down Expand Up @@ -261,7 +261,7 @@ _generate_pb2_grpc_src = rule(
cfg = "exec",
default = Label("//external:protocol_compiler"),
),
"grpc_library": attr.label(
"_grpc_library": attr.label(
default = Label("//src/python/grpcio/grpc:grpcio"),
providers = [PyInfo],
),
Expand All @@ -274,7 +274,6 @@ def py_grpc_library(
srcs,
deps,
strip_prefixes = [],
grpc_library = Label("//src/python/grpcio/grpc:grpcio"),
**kwargs):
"""Generate python code for gRPC services defined in a protobuf.
Expand All @@ -288,9 +287,6 @@ def py_grpc_library(
stripped from the beginning of foo_pb2 modules imported by the
generated stubs. This is useful in combination with the `imports`
attribute of the `py_library` rule.
grpc_library: (`label`) a single `py_library` target representing the
python gRPC library target to be depended upon. This can be used to
generate code that depends on `grpcio` from the Python Package Index.
**kwargs: Additional arguments to be supplied to the invocation of
py_library.
"""
Expand All @@ -305,6 +301,5 @@ def py_grpc_library(
deps = srcs,
py_deps = deps,
strip_prefixes = strip_prefixes,
grpc_library = grpc_library,
**kwargs
)
2 changes: 1 addition & 1 deletion native/build_handwritten.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ settings:
csharp_major_version: 2
g_stands_for: guardian
protobuf_version: 3.25.1
version: 1.62.0-dev
version: 1.62.0-pre1
configs:
asan:
CC: clang
Expand Down
2 changes: 1 addition & 1 deletion native/config.m4

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion native/doc/g_stands_for.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@
- 1.59 'g' stands for ['generative'](https://github.com/grpc/grpc/tree/v1.59.x)
- 1.60 'g' stands for ['gjallarhorn'](https://github.com/grpc/grpc/tree/v1.60.x)
- 1.61 'g' stands for ['grand'](https://github.com/grpc/grpc/tree/v1.61.x)
- 1.62 'g' stands for ['guardian'](https://github.com/grpc/grpc/tree/master)
- 1.62 'g' stands for ['guardian'](https://github.com/grpc/grpc/tree/v1.62.x)
4 changes: 2 additions & 2 deletions native/gRPC-C++.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions native/gRPC-Core.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion native/gRPC-ProtoRPC.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion native/gRPC-RxLibrary.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion native/gRPC.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions native/grpc.def

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions native/include/grpc/grpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ GRPCAPI int grpc_completion_queue_thread_local_cache_flush(
GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state(
grpc_channel* channel, int try_to_connect);

/** Number of active "external connectivity state watchers" attached to a
* channel.
* Useful for testing. **/
GRPCAPI int grpc_channel_num_external_connectivity_watchers(
grpc_channel* channel);

/** Watch for a change in connectivity state.
Once the channel connectivity state is different from last_observed_state,
tag will be enqueued on cq with success=1.
Expand Down
4 changes: 2 additions & 2 deletions native/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 62
#define GRPC_CPP_VERSION_PATCH 0
#define GRPC_CPP_VERSION_TAG "dev"
#define GRPC_CPP_VERSION_STRING "1.62.0-dev"
#define GRPC_CPP_VERSION_TAG "pre1"
#define GRPC_CPP_VERSION_STRING "1.62.0-pre1"

#endif // GRPCPP_VERSION_INFO_H
4 changes: 2 additions & 2 deletions native/package.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion native/src/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6562,7 +6562,6 @@ grpc_cc_library(
],
deps = [
"activity",
"cancel_callback",
"event_engine_common",
"if",
"map",
Expand Down
15 changes: 15 additions & 0 deletions native/src/core/client_channel/channel_connectivity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@ grpc_connectivity_state grpc_channel_check_connectivity_state(
return client_channel->CheckConnectivityState(try_to_connect);
}

int grpc_channel_num_external_connectivity_watchers(grpc_channel* c_channel) {
grpc_core::Channel* channel = grpc_core::Channel::FromC(c_channel);
grpc_core::ClientChannelFilter* client_channel =
grpc_core::ClientChannelFilter::GetFromChannel(channel);
if (client_channel == nullptr) {
if (!grpc_core::IsLameChannel(channel)) {
gpr_log(GPR_ERROR,
"grpc_channel_num_external_connectivity_watchers called on "
"something that is not a client channel");
}
return 0;
}
return client_channel->NumExternalConnectivityWatchers();
}

int grpc_channel_support_connectivity_watcher(grpc_channel* channel) {
return grpc_core::ClientChannelFilter::GetFromChannel(
grpc_core::Channel::FromC(channel)) != nullptr;
Expand Down
5 changes: 5 additions & 0 deletions native/src/core/client_channel/client_channel_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ class ClientChannelFilter {
this, on_complete, /*cancel=*/true);
}

int NumExternalConnectivityWatchers() const {
MutexLock lock(&external_watchers_mu_);
return static_cast<int>(external_watchers_.size());
}

// Starts and stops a connectivity watch. The watcher will be initially
// notified as soon as the state changes from initial_state and then on
// every subsequent state change until either the watch is stopped or
Expand Down
14 changes: 3 additions & 11 deletions native/src/core/client_channel/http_proxy_mapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/match.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
Expand All @@ -46,7 +45,6 @@
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/experiments/experiments.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/env.h"
#include "src/core/lib/gprpp/host_port.h"
Expand Down Expand Up @@ -260,17 +258,11 @@ absl::optional<std::string> HttpProxyMapper::MapName(
MaybeAddDefaultPort(absl::StripPrefix(uri->path(), "/")));
if (user_cred.has_value()) {
// Use base64 encoding for user credentials as stated in RFC 7617
std::string encoded_user_cred;
if (IsAbslBase64Enabled()) {
encoded_user_cred = absl::Base64Escape(*user_cred);
} else {
UniquePtr<char> tmp(
grpc_base64_encode(user_cred->data(), user_cred->length(), 0, 0));
encoded_user_cred = tmp.get();
}
auto encoded_user_cred = UniquePtr<char>(
grpc_base64_encode(user_cred->data(), user_cred->length(), 0, 0));
*args = args->Set(
GRPC_ARG_HTTP_CONNECT_HEADERS,
absl::StrCat("Proxy-Authorization:Basic ", encoded_user_cred));
absl::StrCat("Proxy-Authorization:Basic ", encoded_user_cred.get()));
}
return name_to_resolve;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,16 @@ auto ChaoticGoodConnector::DataEndpointReadSettingsFrame(

auto ChaoticGoodConnector::DataEndpointWriteSettingsFrame(
RefCountedPtr<ChaoticGoodConnector> self) {
// Serialize setting frame.
SettingsFrame frame;
// frame.header set connectiion_type: control
frame.headers = SettingsMetadata{SettingsMetadata::ConnectionType::kData,
self->connection_id_, kDataAlignmentBytes}
.ToMetadataBatch(GetContext<Arena>());
auto write_buffer = frame.Serialize(&self->hpack_compressor_);
return self->data_endpoint_.Write(std::move(write_buffer.control));
return [self]() {
// Serialize setting frame.
SettingsFrame frame;
// frame.header set connectiion_type: control
frame.headers = SettingsMetadata{SettingsMetadata::ConnectionType::kData,
self->connection_id_, kDataAlignmentBytes}
.ToMetadataBatch(GetContext<Arena>());
auto write_buffer = frame.Serialize(&self->hpack_compressor_);
return self->data_endpoint_.Write(std::move(write_buffer.control));
};
}

auto ChaoticGoodConnector::WaitForDataEndpointSetup(
Expand Down Expand Up @@ -198,14 +200,16 @@ auto ChaoticGoodConnector::ControlEndpointReadSettingsFrame(

auto ChaoticGoodConnector::ControlEndpointWriteSettingsFrame(
RefCountedPtr<ChaoticGoodConnector> self) {
// Serialize setting frame.
SettingsFrame frame;
// frame.header set connectiion_type: control
frame.headers = SettingsMetadata{SettingsMetadata::ConnectionType::kControl,
absl::nullopt, absl::nullopt}
.ToMetadataBatch(GetContext<Arena>());
auto write_buffer = frame.Serialize(&self->hpack_compressor_);
return self->control_endpoint_.Write(std::move(write_buffer.control));
return [self]() {
// Serialize setting frame.
SettingsFrame frame;
// frame.header set connectiion_type: control
frame.headers = SettingsMetadata{SettingsMetadata::ConnectionType::kControl,
absl::nullopt, absl::nullopt}
.ToMetadataBatch(GetContext<Arena>());
auto write_buffer = frame.Serialize(&self->hpack_compressor_);
return self->control_endpoint_.Write(std::move(write_buffer.control));
};
}

void ChaoticGoodConnector::Connect(const Args& args, Result* result,
Expand Down
Loading

0 comments on commit 6104cad

Please sign in to comment.