Go to the documentation of this file.
27 #include "absl/container/inlined_vector.h"
28 #include "absl/status/status.h"
29 #include "absl/status/statusor.h"
72 #ifdef GPR_SUPPORT_CHANNELS_FROM_FD
79 #endif // GPR_SUPPORT_CHANNELS_FROM_FD
118 const_cast<char*
>(address.
value().c_str())),
131 args.deadline,
nullptr ,
156 if (
args->endpoint !=
nullptr) {
170 self->result_->Reset();
172 }
else if (
args->endpoint !=
nullptr) {
173 self->result_->transport =
175 self->result_->socket_node =
177 self->result_->channel_args =
args->args;
179 self->endpoint_ =
args->endpoint;
180 self->Ref().release();
182 grpc_schedule_on_exec_ctx);
183 self->Ref().release();
186 &
self->on_receive_settings_,
nullptr);
188 grpc_schedule_on_exec_ctx);
197 self->handshake_mgr_.reset();
206 if (!
self->notify_error_.has_value()) {
208 self->args_.interested_parties);
215 self->result_->Reset();
232 if (!
self->notify_error_.has_value()) {
236 self->args_.interested_parties);
241 self->result_->Reset();
243 "connection attempt timed out before receiving SETTINGS frame"));
275 if (new_args ==
nullptr) {
277 "Failed to create channel args during subchannel creation.");
281 MakeOrphanable<Chttp2Connector>(), address, new_args);
291 if (channel_credentials ==
nullptr) {
293 "Can't create subchannel: channel credentials missing for secure "
294 "channel. Got args: %s",
301 "Can't create subchannel: security connector already present in "
306 const char* authority =
311 RefCountedPtr<grpc_channel_security_connector>
312 subchannel_security_connector =
314 nullptr, authority,
args,
315 &new_args_from_connector);
316 if (subchannel_security_connector ==
nullptr) {
318 "Failed to create secure subchannel for secure name '%s'",
322 grpc_arg new_security_connector_arg =
325 new_args_from_connector !=
nullptr ? new_args_from_connector :
args,
326 &new_security_connector_arg, 1);
327 subchannel_security_connector.reset(
DEBUG_LOCATION,
"lb_channel_create");
353 grpc_core::Chttp2SecureClientChannelFactory* g_factory;
357 g_factory =
new grpc_core::Chttp2SecureClientChannelFactory();
370 GRPC_API_TRACE(
"grpc_secure_channel_create(target=%s, creds=%p, args=%p)", 3,
371 (
target, (
void*)creds, (
void*)c_args));
374 if (creds !=
nullptr) {
380 .channel_args_preconditioning()
381 .PreconditionChannelArgs(c_args)
382 .SetObject(creds->Ref())
383 .SetObject(g_factory));
400 target,
status,
"Failed to create secure client channel");
405 #ifdef GPR_SUPPORT_CHANNELS_FROM_FD
411 "grpc_channel_create_from_fd(target=%p, fd=%d, creds=%p, args=%p)", 4,
414 if (creds ==
nullptr ||
418 "Failed to create client channel due to invalid creds");
428 int flags = fcntl(fd, F_GETFL, 0);
442 return channel->release()->c_ptr();
447 "Failed to create client channel");
451 #else // !GPR_SUPPORT_CHANNELS_FROM_FD
461 #endif // GPR_SUPPORT_CHANNELS_FROM_FD
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Status InvalidArgumentError(absl::string_view message)
char * grpc_channel_args_find_string(const grpc_channel_args *args, const char *name)
static void OnHandshakeDone(void *arg, grpc_error_handle error)
std::string ToString(StatusToStringMode mode=StatusToStringMode::kDefault) const
#define GPR_DEBUG_ASSERT(x)
static grpc_channel * CreateChannel()
grpc_transport * grpc_create_chttp2_transport(const grpc_channel_args *channel_args, grpc_endpoint *ep, bool is_client)
virtual grpc_core::UniqueTypeName type() const =0
@ GRPC_CLIENT_DIRECT_CHANNEL
GRPCAPI grpc_channel * grpc_lame_client_channel_create(const char *target, grpc_status_code error_code, const char *error_message)
GPRAPI void gpr_free(void *ptr)
static ChannelArgs FromC(const grpc_channel_args *args)
void grpc_endpoint_delete_from_pollset_set(grpc_endpoint *ep, grpc_pollset_set *pollset_set)
grpc_arg grpc_channel_arg_string_create(char *name, char *value)
GRPC_MUST_USE_RESULT ChannelArgs SetIfUnset(absl::string_view name, T value)
static void OnTimeout(void *arg, grpc_error_handle error)
grpc_endpoint * grpc_tcp_client_create_from_fd(grpc_fd *fd, const grpc_channel_args *channel_args, absl::string_view addr_str)
grpc_arg grpc_security_connector_to_arg(grpc_security_connector *sc)
grpc_pollset_set * interested_parties
GPRAPI void gpr_once_init(gpr_once *once, void(*init_function)(void))
static UniqueTypeName Type()
#define GRPC_ARG_DEFAULT_AUTHORITY
std::string AddDefaultPrefixIfNeeded(absl::string_view target) const
Returns target with the default prefix prepended, if needed.
GRPC_MUST_USE_RESULT ChannelArgs SetObject(T *p) const
wrapped_grpc_channel * channel
const grpc_channel_args * channel_args
static const CoreConfiguration & Get()
def c_str(s, encoding='ascii')
static void OnReceiveSettings(void *arg, grpc_error_handle error)
#define GRPC_ARG_SERVER_URI
RefCountedPtr< SubchannelConnector > Ref() GRPC_MUST_USE_RESULT
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
grpc_fd * grpc_fd_create(int fd, const char *name, bool track_err)
void grpc_transport_destroy(grpc_transport *transport)
grpc_channel_credentials * grpc_channel_credentials_find_in_args(const grpc_channel_args *args)
const grpc_channel_args * ToC() const
void grpc_channel_args_destroy(grpc_channel_args *a)
bool grpc_error_get_int(grpc_error_handle err, grpc_error_ints which, intptr_t *p)
const HandshakerRegistry & handshaker_registry() const
void grpc_endpoint_shutdown(grpc_endpoint *ep, grpc_error_handle why)
size_type size() const noexcept
void grpc_endpoint_destroy(grpc_endpoint *ep)
const ChannelArgsPreconditioning & channel_args_preconditioning() const
static RefCountedPtr< Subchannel > Create(OrphanablePtr< SubchannelConnector > connector, const grpc_resolved_address &address, const grpc_channel_args *args)
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
grpc_core::RefCountedPtr< grpc_core::channelz::SocketNode > grpc_chttp2_transport_get_socket_node(grpc_transport *transport)
void Connect(const Args &args, Result *result, grpc_closure *notify) override
void grpc_timer_cancel(grpc_timer *timer)
RefCountedPtr< HandshakeManager > handshake_mgr_
ABSL_MUST_USE_RESULT bool ok() const
void AddHandshakers(HandshakerType handshaker_type, const grpc_channel_args *args, grpc_pollset_set *interested_parties, HandshakeManager *handshake_mgr) const
#define GRPC_ERROR_REF(err)
#define GRPC_ARG_TCP_HANDSHAKER_RESOLVED_ADDRESS
grpc_error_handle absl_status_to_grpc_error(absl::Status status)
grpc_arg grpc_channel_arg_integer_create(char *name, int value)
grpc_core::ExecCtx exec_ctx
#define GRPC_ERROR_CREATE_FROM_CPP_STRING(desc)
#define GRPC_ARG_TCP_HANDSHAKER_BIND_ENDPOINT_TO_POLLSET
const ResolverRegistry & resolver_registry() const
void grpc_timer_init(grpc_timer *timer, grpc_core::Timestamp deadline, grpc_closure *closure)
#define GRPC_ERROR_UNREF(err)
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error_handle error)
struct grpc_channel grpc_channel
grpc_security_connector * grpc_security_connector_find_in_args(const grpc_channel_args *args)
void grpc_slice_buffer_destroy_internal(grpc_slice_buffer *sb)
const T & value() const &ABSL_ATTRIBUTE_LIFETIME_BOUND
~Chttp2Connector() override
absl::optional< grpc_error_handle > notify_error_
grpc_channel * grpc_channel_create(const char *target, grpc_channel_credentials *creds, const grpc_channel_args *c_args)
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern self
virtual grpc_core::RefCountedPtr< grpc_channel_security_connector > create_security_connector(grpc_core::RefCountedPtr< grpc_call_credentials > call_creds, const char *target, const grpc_channel_args *args, grpc_channel_args **new_args)=0
absl::StatusOr< std::string > grpc_sockaddr_to_uri(const grpc_resolved_address *resolved_addr)
void Shutdown(grpc_error_handle error) override
ChannelArgs PreconditionChannelArgs(const grpc_channel_args *args) const
void MaybeNotify(grpc_error_handle error)
static absl::StatusOr< RefCountedPtr< Channel > > Create(const char *target, ChannelArgs args, grpc_channel_stack_type channel_stack_type, grpc_transport *optional_transport)
std::string grpc_channel_args_string(const grpc_channel_args *args)
grpc_channel * grpc_channel_create_from_fd(const char *, int, grpc_channel_credentials *, const grpc_channel_args *)
void grpc_chttp2_transport_start_reading(grpc_transport *transport, grpc_slice_buffer *read_buffer, grpc_closure *notify_on_receive_settings, grpc_closure *notify_on_close)
grpc_channel_args * grpc_channel_args_copy_and_add(const grpc_channel_args *src, const grpc_arg *to_add, size_t num_to_add)
RefCountedPtr< Child > Ref() GRPC_MUST_USE_RESULT
grpc_endpoint * endpoint_
@ GRPC_ERROR_INT_GRPC_STATUS
grpc status code representing this error
#define GRPC_API_TRACE(fmt, nargs, args)
const Status & status() const &
#define GRPC_ERROR_IS_NONE(err)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:53