chttp2_connector.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H
20 #define GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H
21 
23 
24 #include "absl/types/optional.h"
25 
34 
35 namespace grpc_core {
36 
38  public:
39  ~Chttp2Connector() override;
40 
41  void Connect(const Args& args, Result* result, grpc_closure* notify) override;
42  void Shutdown(grpc_error_handle error) override;
43 
44  private:
45  static void OnHandshakeDone(void* arg, grpc_error_handle error);
46  static void OnReceiveSettings(void* arg, grpc_error_handle error);
47  static void OnTimeout(void* arg, grpc_error_handle error);
48 
49  // We cannot invoke notify_ until both OnTimeout() and OnReceiveSettings()
50  // have been called since that is an indicator to the upper layer that we are
51  // done with the connection attempt. So, the notification process is broken
52  // into two steps. 1) Either OnTimeout() or OnReceiveSettings() gets invoked
53  // first. Whichever gets invoked, calls MaybeNotify() to set the result and
54  // triggers the other callback to be invoked. 2) When the other callback is
55  // invoked, we call MaybeNotify() again to actually invoke the notify_
56  // callback. Note that this only happens if the handshake is done and the
57  // connector is waiting on the SETTINGS frame.
59 
62  Result* result_ = nullptr;
63  grpc_closure* notify_ = nullptr;
64  bool shutdown_ = false;
65  // Holds the endpoint when first created before being handed off to
66  // the handshake manager, and then again after handshake is done.
73 };
74 
75 } // namespace grpc_core
76 
77 #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_CLIENT_CHTTP2_CONNECTOR_H */
grpc_core::SubchannelConnector::Args
Definition: connector.h:41
grpc_core::Chttp2Connector::on_receive_settings_
grpc_closure on_receive_settings_
Definition: chttp2_connector.h:68
grpc_core::Chttp2Connector::OnHandshakeDone
static void OnHandshakeDone(void *arg, grpc_error_handle error)
Definition: chttp2_connector.cc:146
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
connector.h
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::SubchannelConnector
Definition: connector.h:39
grpc_core::Chttp2Connector
Definition: chttp2_connector.h:37
error
grpc_error_handle error
Definition: retry_filter.cc:499
closure.h
grpc_timer
Definition: iomgr/timer.h:33
grpc_core::Chttp2Connector::mu_
Mutex mu_
Definition: chttp2_connector.h:60
grpc_core::Chttp2Connector::OnTimeout
static void OnTimeout(void *arg, grpc_error_handle error)
Definition: chttp2_connector.cc:228
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_core::RefCountedPtr
Definition: ref_counted_ptr.h:35
grpc_core::Chttp2Connector::timer_
grpc_timer timer_
Definition: chttp2_connector.h:69
grpc_core::Chttp2Connector::OnReceiveSettings
static void OnReceiveSettings(void *arg, grpc_error_handle error)
Definition: chttp2_connector.cc:202
absl::optional
Definition: abseil-cpp/absl/types/internal/optional.h:61
arg
Definition: cmdline.cc:40
error.h
grpc_core::SubchannelConnector::Result
Definition: connector.h:52
grpc_core::Chttp2Connector::Connect
void Connect(const Args &args, Result *result, grpc_closure *notify) override
Definition: chttp2_connector.cc:98
grpc_core::Chttp2Connector::handshake_mgr_
RefCountedPtr< HandshakeManager > handshake_mgr_
Definition: chttp2_connector.h:72
grpc_core::Mutex
Definition: src/core/lib/gprpp/sync.h:61
grpc_core::Chttp2Connector::args_
Args args_
Definition: chttp2_connector.h:61
grpc_core::Chttp2Connector::result_
Result * result_
Definition: chttp2_connector.h:62
grpc_core::Chttp2Connector::shutdown_
bool shutdown_
Definition: chttp2_connector.h:64
handshaker.h
ref_counted_ptr.h
timer.h
endpoint.h
grpc_core::Chttp2Connector::~Chttp2Connector
~Chttp2Connector() override
Definition: chttp2_connector.cc:92
grpc_error
Definition: error_internal.h:42
grpc_core::Chttp2Connector::notify_error_
absl::optional< grpc_error_handle > notify_error_
Definition: chttp2_connector.h:71
grpc_core::Chttp2Connector::notify_
grpc_closure * notify_
Definition: chttp2_connector.h:63
grpc_closure
Definition: closure.h:56
grpc_core::Chttp2Connector::Shutdown
void Shutdown(grpc_error_handle error) override
Definition: chttp2_connector.cc:136
grpc_endpoint
Definition: endpoint.h:105
grpc_core::Chttp2Connector::MaybeNotify
void MaybeNotify(grpc_error_handle error)
Definition: chttp2_connector.cc:253
sync.h
grpc_core::Chttp2Connector::endpoint_
grpc_endpoint * endpoint_
Definition: chttp2_connector.h:67
grpc_core::Chttp2Connector::on_timeout_
grpc_closure on_timeout_
Definition: chttp2_connector.h:70
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:45