Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update grpc 1.46.5 #593

Merged
merged 10 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions benchmark/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,16 +370,18 @@ impl Client {
builder = builder.raw_cfg_int(key, arg.get_int_value() as i32);
}
}
// Check https://github.com/grpc/grpc/issues/31465.
builder = builder.enable_retry(false);
if cfg.has_security_params() {
let params = cfg.get_security_params();
if !params.get_server_host_override().is_empty() {
builder = builder
.override_ssl_target(params.get_server_host_override().to_owned());
}
builder.secure_connect(addr, proto_util::create_test_channel_credentials())
} else {
builder.connect(addr)
builder =
builder.set_credentials(proto_util::create_test_channel_credentials());
}
builder.connect(addr)
});

let client_type = cfg.get_client_type();
Expand Down
10 changes: 5 additions & 5 deletions benchmark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::sync::Arc;
use benchmark::{init_log, Worker};
use clap::{App, Arg};
use futures_channel::oneshot;
use grpc::{Environment, ServerBuilder};
use grpc::{Environment, ServerBuilder, ServerCredentials};
use grpc_proto::testing::services_grpc::create_worker_service;
use rand::Rng;

Expand Down Expand Up @@ -40,13 +40,13 @@ fn main() {
let service = create_worker_service(worker);
let mut server = ServerBuilder::new(env)
.register_service(service)
.bind("[::]", port)
.build()
.unwrap();
let port = server
.add_listening_port(&format!("[::]:{port}"), ServerCredentials::insecure())
.unwrap();

for (host, port) in server.bind_addrs() {
info!("listening on {}:{}", host, port);
}
info!("listening on [::]:{}", port);

server.start();

Expand Down
21 changes: 11 additions & 10 deletions benchmark/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::ffi::CString;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;

use grpc::ServerCredentials;
use grpc_proto::testing::control::{ServerConfig, ServerStatus, ServerType};
use grpc_proto::testing::services_grpc::create_benchmark_service;
use grpc_proto::testing::stats::ServerStats;
Expand All @@ -17,6 +18,7 @@ use crate::util::{self, CpuRecorder};

pub struct Server {
server: GrpcServer,
port: u16,
recorder: CpuRecorder,
keep_running: Arc<AtomicBool>,
}
Expand Down Expand Up @@ -60,20 +62,19 @@ impl Server {
}
builder = builder.channel_args(ch_builder.build_args());
}
builder = if cfg.has_security_params() {
builder.bind_with_cred(
"[::]",
cfg.get_port() as u16,
proto_util::create_test_server_credentials(),
)
let mut s = builder.build().unwrap();
let creds = if cfg.has_security_params() {
proto_util::create_test_server_credentials()
} else {
builder.bind("[::]", cfg.get_port() as u16)
ServerCredentials::insecure()
};

let mut s = builder.build().unwrap();
let port = s
.add_listening_port(&format!("[::]:{}", cfg.get_port()), creds)
.unwrap();
s.start();
Ok(Server {
server: s,
port,
recorder: CpuRecorder::new(),
keep_running: keep_running1,
})
Expand All @@ -98,7 +99,7 @@ impl Server {

pub fn get_status(&self) -> ServerStatus {
let mut status = ServerStatus::default();
status.set_port(i32::from(self.server.bind_addrs().next().unwrap().1));
status.set_port(self.port as i32);
status.set_cores(util::cpu_num_cores() as i32);
status
}
Expand Down
161 changes: 68 additions & 93 deletions grpc-sys/bindings/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,10 @@ pub const GRPC_WRITE_BUFFER_HINT: u32 = 1;
pub const GRPC_WRITE_NO_COMPRESS: u32 = 2;
pub const GRPC_WRITE_THROUGH: u32 = 4;
pub const GRPC_WRITE_USED_MASK: u32 = 7;
pub const GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST: u32 = 16;
pub const GRPC_INITIAL_METADATA_WAIT_FOR_READY: u32 = 32;
pub const GRPC_INITIAL_METADATA_CACHEABLE_REQUEST: u32 = 64;
pub const GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET: u32 = 128;
pub const GRPC_INITIAL_METADATA_CORKED: u32 = 256;
pub const GRPC_INITIAL_METADATA_USED_MASK: u32 = 500;
pub const GRPC_INITIAL_METADATA_USED_MASK: u32 = 420;
pub const GRPC_CQ_CURRENT_VERSION: u32 = 2;
pub const GRPC_CQ_VERSION_MINIMUM_FOR_CALLBACKABLE: u32 = 2;
pub const GRPC_MAX_COMPLETION_QUEUE_PLUCKERS: u32 = 6;
Expand Down Expand Up @@ -226,6 +224,9 @@ pub struct grpc_slice_refcount {
#[doc = ""]
#[doc = "If the slice does not have a refcount, it represents an inlined small piece"]
#[doc = "of data that is copied by value."]
#[doc = ""]
#[doc = "As a special case, a slice can be given refcount == uintptr_t(1), meaning"]
#[doc = "that the slice represents external data that is not refcounted."]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct grpc_slice {
Expand Down Expand Up @@ -474,13 +475,6 @@ extern "C" {
extern "C" {
pub fn grpc_slice_malloc_large(length: usize) -> grpc_slice;
}
extern "C" {
#[doc = " Intern a slice:"]
#[doc = ""]
#[doc = "The return value for two invocations of this function with the same sequence"]
#[doc = "of bytes is a slice which points to the same memory."]
pub fn grpc_slice_intern(slice: grpc_slice) -> grpc_slice;
}
extern "C" {
#[doc = " Create a slice by copying a string."]
#[doc = "Does not preserve null terminators."]
Expand Down Expand Up @@ -555,12 +549,6 @@ extern "C" {
extern "C" {
pub fn grpc_empty_slice() -> grpc_slice;
}
extern "C" {
pub fn grpc_slice_default_hash_impl(s: grpc_slice) -> u32;
}
extern "C" {
pub fn grpc_slice_default_eq_impl(a: grpc_slice, b: grpc_slice) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn grpc_slice_eq(a: grpc_slice, b: grpc_slice) -> ::std::os::raw::c_int;
}
Expand Down Expand Up @@ -596,9 +584,6 @@ extern "C" {
#[doc = "if it's not found"]
pub fn grpc_slice_slice(haystack: grpc_slice, needle: grpc_slice) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn grpc_slice_hash(s: grpc_slice) -> u32;
}
extern "C" {
#[doc = " Do two slices point at the same memory, with the same length"]
#[doc = "If a or b is inlined, actually compares data"]
Expand Down Expand Up @@ -1934,18 +1919,38 @@ extern "C" {
#[doc = "to non-experimental or remove it."]
pub fn grpc_channel_reset_connect_backoff(channel: *mut grpc_channel);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct grpc_channel_credentials {
_unused: [u8; 0],
}
extern "C" {
#[doc = " Create a client channel to 'target'. Additional channel level configuration"]
#[doc = "MAY be provided by grpc_channel_args, though the expectation is that most"]
#[doc = "clients will want to simply pass NULL. The user data in 'args' need only"]
#[doc = "live through the invocation of this function. However, if any args of the"]
#[doc = "'pointer' type are passed, then the referenced vtable must be maintained"]
#[doc = "by the caller until grpc_channel_destroy terminates. See grpc_channel_args"]
#[doc = "definition for more on this."]
pub fn grpc_insecure_channel_create(
#[doc = " Releases a channel credentials object."]
#[doc = "The creator of the credentials object is responsible for its release."]
pub fn grpc_channel_credentials_release(creds: *mut grpc_channel_credentials);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct grpc_server_credentials {
_unused: [u8; 0],
}
extern "C" {
#[doc = " Releases a server_credentials object."]
#[doc = "The creator of the server_credentials object is responsible for its release."]
pub fn grpc_server_credentials_release(creds: *mut grpc_server_credentials);
}
extern "C" {
#[doc = " Creates a secure channel using the passed-in credentials. Additional"]
#[doc = "channel level configuration MAY be provided by grpc_channel_args, though"]
#[doc = "the expectation is that most clients will want to simply pass NULL. The"]
#[doc = "user data in 'args' need only live through the invocation of this function."]
#[doc = "However, if any args of the 'pointer' type are passed, then the referenced"]
#[doc = "vtable must be maintained by the caller until grpc_channel_destroy"]
#[doc = "terminates. See grpc_channel_args definition for more on this."]
pub fn grpc_channel_create(
target: *const ::std::os::raw::c_char,
creds: *mut grpc_channel_credentials,
args: *const grpc_channel_args,
reserved: *mut ::std::os::raw::c_void,
) -> *mut grpc_channel;
}
extern "C" {
Expand Down Expand Up @@ -2128,12 +2133,13 @@ extern "C" {
);
}
extern "C" {
#[doc = " Add a HTTP2 over plaintext over tcp listener."]
#[doc = " Add a HTTP2 over an encrypted link over tcp listener."]
#[doc = "Returns bound port number on success, 0 on failure."]
#[doc = "REQUIRES: server not started"]
pub fn grpc_server_add_insecure_http2_port(
pub fn grpc_server_add_http2_port(
server: *mut grpc_server,
addr: *const ::std::os::raw::c_char,
creds: *mut grpc_server_credentials,
) -> ::std::os::raw::c_int;
}
extern "C" {
Expand Down Expand Up @@ -2283,30 +2289,31 @@ extern "C" {
) -> *mut grpc_channel;
}
extern "C" {
#[doc = " Create a client channel to 'target' using file descriptor 'fd'. The 'target'"]
#[doc = "argument will be used to indicate the name for this channel. See the comment"]
#[doc = "for grpc_insecure_channel_create for description of 'args' argument."]
pub fn grpc_insecure_channel_create_from_fd(
#[doc = " Create a secure channel to 'target' using file descriptor 'fd' and passed-in"]
#[doc = "credentials. The 'target' argument will be used to indicate the name for"]
#[doc = "this channel. Note that this API currently only supports insecure channel"]
#[doc = "credentials. Using other types of credentials will result in a failure."]
pub fn grpc_channel_create_from_fd(
target: *const ::std::os::raw::c_char,
fd: ::std::os::raw::c_int,
creds: *mut grpc_channel_credentials,
args: *const grpc_channel_args,
) -> *mut grpc_channel;
}
extern "C" {
#[doc = " Add the connected communication channel based on file descriptor 'fd' to the"]
#[doc = "'server'. The 'fd' must be an open file descriptor corresponding to a"]
#[doc = "connected socket. Events from the file descriptor may come on any of the"]
#[doc = "server completion queues (i.e completion queues registered via the"]
#[doc = "grpc_server_register_completion_queue API)."]
#[doc = ""]
#[doc = "The 'reserved' pointer MUST be NULL."]
#[doc = ""]
#[doc = " Add the connected secure communication channel based on file descriptor 'fd'"]
#[doc = "to the 'server' and server credentials 'creds'. The 'fd' must be an open file"]
#[doc = "descriptor corresponding to a connected socket. Events from the file"]
#[doc = "descriptor may come on any of the server completion queues (i.e completion"]
#[doc = "queues registered via the grpc_server_register_completion_queue API)."]
#[doc = "Note that this API currently only supports inseure server credentials"]
#[doc = "Using other types of credentials will result in a failure."]
#[doc = "TODO(hork): add channel_args to this API to allow endpoints and transports"]
#[doc = "created in this function to participate in the resource quota feature."]
pub fn grpc_server_add_insecure_channel_from_fd(
pub fn grpc_server_add_channel_from_fd(
server: *mut grpc_server,
reserved: *mut ::std::os::raw::c_void,
fd: ::std::os::raw::c_int,
creds: *mut grpc_server_credentials,
);
}
#[repr(u32)]
Expand Down Expand Up @@ -2529,16 +2536,6 @@ extern "C" {
#[doc = "The creator of the credentials object is responsible for its release."]
pub fn grpc_call_credentials_release(creds: *mut grpc_call_credentials);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct grpc_channel_credentials {
_unused: [u8; 0],
}
extern "C" {
#[doc = " Releases a channel credentials object."]
#[doc = "The creator of the credentials object is responsible for its release."]
pub fn grpc_channel_credentials_release(creds: *mut grpc_channel_credentials);
}
extern "C" {
#[doc = " Creates default credentials to connect to a google gRPC service."]
#[doc = "WARNING: Do NOT use this credentials to connect to a non-google service as"]
Expand Down Expand Up @@ -2905,31 +2902,6 @@ extern "C" {
reserved: *mut ::std::os::raw::c_void,
) -> *mut grpc_call_credentials;
}
extern "C" {
#[doc = " Creates a secure channel using the passed-in credentials. Additional"]
#[doc = "channel level configuration MAY be provided by grpc_channel_args, though"]
#[doc = "the expectation is that most clients will want to simply pass NULL. The"]
#[doc = "user data in 'args' need only live through the invocation of this function."]
#[doc = "However, if any args of the 'pointer' type are passed, then the referenced"]
#[doc = "vtable must be maintained by the caller until grpc_channel_destroy"]
#[doc = "terminates. See grpc_channel_args definition for more on this."]
pub fn grpc_secure_channel_create(
creds: *mut grpc_channel_credentials,
target: *const ::std::os::raw::c_char,
args: *const grpc_channel_args,
reserved: *mut ::std::os::raw::c_void,
) -> *mut grpc_channel;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct grpc_server_credentials {
_unused: [u8; 0],
}
extern "C" {
#[doc = " Releases a server_credentials object."]
#[doc = "The creator of the server_credentials object is responsible for its release."]
pub fn grpc_server_credentials_release(creds: *mut grpc_server_credentials);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct grpc_ssl_server_certificate_config {
Expand Down Expand Up @@ -3046,16 +3018,6 @@ extern "C" {
options: *mut grpc_ssl_server_credentials_options,
) -> *mut grpc_server_credentials;
}
extern "C" {
#[doc = " Add a HTTP2 over an encrypted link over tcp listener."]
#[doc = "Returns bound port number on success, 0 on failure."]
#[doc = "REQUIRES: server not started"]
pub fn grpc_server_add_secure_http2_port(
server: *mut grpc_server,
addr: *const ::std::os::raw::c_char,
creds: *mut grpc_server_credentials,
) -> ::std::os::raw::c_int;
}
extern "C" {
#[doc = " Sets a credentials to a call. Can only be called on the client side before"]
#[doc = "grpc_call_start_batch."]
Expand Down Expand Up @@ -3668,9 +3630,9 @@ pub struct grpc_authorization_policy_provider {
}
extern "C" {
#[doc = " EXPERIMENTAL - Subject to change."]
#[doc = " Creates a grpc_authorization_policy_provider using SDK authorization policy"]
#[doc = " Creates a grpc_authorization_policy_provider using gRPC authorization policy"]
#[doc = " from static string."]
#[doc = " - authz_policy is the input SDK authorization policy."]
#[doc = " - authz_policy is the input gRPC authorization policy."]
#[doc = " - code is the error status code on failure. On success, it equals"]
#[doc = " GRPC_STATUS_OK."]
#[doc = " - error_details contains details about the error if any. If the"]
Expand All @@ -3684,9 +3646,9 @@ extern "C" {
}
extern "C" {
#[doc = " EXPERIMENTAL - Subject to change."]
#[doc = " Creates a grpc_authorization_policy_provider by watching for SDK"]
#[doc = " Creates a grpc_authorization_policy_provider by watching for gRPC"]
#[doc = " authorization policy changes in filesystem."]
#[doc = " - authz_policy is the file path of SDK authorization policy."]
#[doc = " - authz_policy is the file path of gRPC authorization policy."]
#[doc = " - refresh_interval_sec is the amount of time the internal thread would wait"]
#[doc = " before checking for file updates."]
#[doc = " - code is the error status code on failure. On success, it equals"]
Expand All @@ -3709,6 +3671,19 @@ extern "C" {
provider: *mut grpc_authorization_policy_provider,
);
}
extern "C" {
#[doc = " EXPERIMENTAL API - Subject to change."]
#[doc = " Configures a grpc_tls_credentials_options object with tls session key"]
#[doc = " logging capability. TLS channels using these credentials have tls session"]
#[doc = " key logging enabled."]
#[doc = " - options is the grpc_tls_credentials_options object"]
#[doc = " - path is a string pointing to the location where TLS session keys would be"]
#[doc = " stored."]
pub fn grpc_tls_credentials_options_set_tls_session_key_log_file_path(
options: *mut grpc_tls_credentials_options,
path: *const ::std::os::raw::c_char,
);
}
#[repr(u32)]
#[doc = " The severity of a log message - use the #defines below when calling into"]
#[doc = "gpr_log to additionally supply file and line data"]
Expand Down
2 changes: 1 addition & 1 deletion grpc-sys/grpc
Submodule grpc updated from 38a9cd to 996605
Loading