grpc 1.17.1 → 1.18.0.pre1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1228 -988
  3. data/etc/roots.pem +242 -30
  4. data/include/grpc/grpc.h +2 -1
  5. data/include/grpc/grpc_security_constants.h +3 -3
  6. data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
  7. data/include/grpc/impl/codegen/atm_windows.h +2 -0
  8. data/include/grpc/impl/codegen/compression_types.h +2 -1
  9. data/include/grpc/impl/codegen/grpc_types.h +1 -1
  10. data/include/grpc/impl/codegen/port_platform.h +9 -0
  11. data/src/core/ext/filters/client_channel/client_channel.cc +163 -882
  12. data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -4
  13. data/src/core/ext/filters/client_channel/health/health_check_client.h +2 -3
  14. data/src/core/ext/filters/client_channel/lb_policy.cc +1 -1
  15. data/src/core/ext/filters/client_channel/lb_policy.h +8 -17
  16. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +176 -216
  17. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -1
  18. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +20 -23
  19. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
  20. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +49 -52
  21. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +13 -35
  22. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +31 -30
  23. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +69 -225
  24. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h +1 -1
  25. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +20 -23
  26. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +1 -1
  27. data/src/core/ext/filters/client_channel/lb_policy_factory.h +2 -84
  28. data/src/core/ext/filters/client_channel/request_routing.cc +936 -0
  29. data/src/core/ext/filters/client_channel/request_routing.h +177 -0
  30. data/src/core/ext/filters/client_channel/resolver.cc +1 -1
  31. data/src/core/ext/filters/client_channel/resolver.h +1 -1
  32. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +37 -26
  33. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +30 -18
  34. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +119 -100
  35. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +8 -5
  36. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +5 -4
  37. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc +2 -1
  38. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +12 -14
  39. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +5 -9
  40. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -1
  41. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +1 -2
  42. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +17 -17
  43. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +45 -52
  44. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +13 -17
  45. data/src/core/ext/filters/client_channel/server_address.cc +103 -0
  46. data/src/core/ext/filters/client_channel/server_address.h +108 -0
  47. data/src/core/ext/filters/client_channel/subchannel.cc +10 -8
  48. data/src/core/ext/filters/client_channel/subchannel.h +9 -6
  49. data/src/core/ext/filters/client_channel/subchannel_index.cc +20 -27
  50. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +3 -2
  51. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +8 -9
  52. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
  53. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +1 -1
  54. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +8 -11
  55. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +24 -54
  56. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -1
  57. data/src/core/ext/transport/chttp2/transport/context_list.cc +67 -0
  58. data/src/core/ext/transport/chttp2/transport/context_list.h +53 -0
  59. data/src/core/ext/transport/chttp2/transport/internal.h +38 -11
  60. data/src/core/ext/transport/chttp2/transport/writing.cc +5 -0
  61. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
  62. data/src/core/lib/channel/channelz.cc +19 -18
  63. data/src/core/lib/channel/channelz.h +7 -1
  64. data/src/core/lib/channel/channelz_registry.cc +3 -2
  65. data/src/core/lib/debug/trace.cc +3 -0
  66. data/src/core/lib/debug/trace.h +5 -3
  67. data/src/core/lib/gpr/sync_posix.cc +96 -4
  68. data/src/core/lib/gprpp/inlined_vector.h +25 -19
  69. data/src/core/lib/gprpp/memory.h +2 -11
  70. data/src/core/lib/gprpp/orphanable.h +18 -82
  71. data/src/core/lib/gprpp/ref_counted.h +75 -84
  72. data/src/core/lib/gprpp/ref_counted_ptr.h +22 -17
  73. data/src/core/lib/http/httpcli_security_connector.cc +101 -94
  74. data/src/core/lib/http/parser.h +5 -5
  75. data/src/core/lib/iomgr/buffer_list.cc +16 -5
  76. data/src/core/lib/iomgr/buffer_list.h +10 -3
  77. data/src/core/lib/iomgr/call_combiner.cc +50 -2
  78. data/src/core/lib/iomgr/call_combiner.h +29 -2
  79. data/src/core/lib/iomgr/dynamic_annotations.h +67 -0
  80. data/src/core/lib/iomgr/endpoint.cc +4 -0
  81. data/src/core/lib/iomgr/endpoint.h +3 -0
  82. data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
  83. data/src/core/lib/iomgr/ev_epoll1_linux.cc +4 -0
  84. data/src/core/lib/iomgr/ev_epollex_linux.cc +4 -0
  85. data/src/core/lib/iomgr/ev_poll_posix.cc +4 -0
  86. data/src/core/lib/iomgr/ev_posix.cc +15 -7
  87. data/src/core/lib/iomgr/ev_posix.h +10 -0
  88. data/src/core/lib/iomgr/exec_ctx.cc +13 -0
  89. data/src/core/lib/iomgr/fork_posix.cc +1 -1
  90. data/src/core/lib/iomgr/internal_errqueue.cc +36 -3
  91. data/src/core/lib/iomgr/internal_errqueue.h +7 -1
  92. data/src/core/lib/iomgr/iomgr.cc +7 -0
  93. data/src/core/lib/iomgr/iomgr.h +4 -0
  94. data/src/core/lib/iomgr/iomgr_custom.cc +3 -1
  95. data/src/core/lib/iomgr/iomgr_internal.cc +4 -0
  96. data/src/core/lib/iomgr/iomgr_internal.h +4 -0
  97. data/src/core/lib/iomgr/iomgr_posix.cc +6 -1
  98. data/src/core/lib/iomgr/iomgr_windows.cc +4 -1
  99. data/src/core/lib/iomgr/port.h +1 -2
  100. data/src/core/lib/iomgr/resource_quota.cc +1 -0
  101. data/src/core/lib/iomgr/sockaddr_utils.cc +1 -0
  102. data/src/core/lib/iomgr/tcp_custom.cc +4 -1
  103. data/src/core/lib/iomgr/tcp_posix.cc +95 -35
  104. data/src/core/lib/iomgr/tcp_windows.cc +4 -1
  105. data/src/core/lib/iomgr/timer_manager.cc +6 -0
  106. data/src/core/lib/security/context/security_context.cc +75 -108
  107. data/src/core/lib/security/context/security_context.h +59 -35
  108. data/src/core/lib/security/credentials/alts/alts_credentials.cc +36 -48
  109. data/src/core/lib/security/credentials/alts/alts_credentials.h +37 -10
  110. data/src/core/lib/security/credentials/composite/composite_credentials.cc +97 -157
  111. data/src/core/lib/security/credentials/composite/composite_credentials.h +60 -24
  112. data/src/core/lib/security/credentials/credentials.cc +18 -142
  113. data/src/core/lib/security/credentials/credentials.h +119 -95
  114. data/src/core/lib/security/credentials/fake/fake_credentials.cc +46 -71
  115. data/src/core/lib/security/credentials/fake/fake_credentials.h +23 -5
  116. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +144 -51
  117. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +28 -5
  118. data/src/core/lib/security/credentials/iam/iam_credentials.cc +27 -35
  119. data/src/core/lib/security/credentials/iam/iam_credentials.h +18 -4
  120. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +60 -69
  121. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +29 -10
  122. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -0
  123. data/src/core/lib/security/credentials/local/local_credentials.cc +19 -32
  124. data/src/core/lib/security/credentials/local/local_credentials.h +32 -11
  125. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +130 -149
  126. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +74 -29
  127. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +59 -77
  128. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +40 -17
  129. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +66 -83
  130. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +58 -15
  131. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +152 -177
  132. data/src/core/lib/security/security_connector/alts/alts_security_connector.h +12 -10
  133. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +210 -215
  134. data/src/core/lib/security/security_connector/fake/fake_security_connector.h +9 -6
  135. data/src/core/lib/security/security_connector/local/local_security_connector.cc +176 -169
  136. data/src/core/lib/security/security_connector/local/local_security_connector.h +10 -9
  137. data/src/core/lib/security/security_connector/security_connector.cc +41 -124
  138. data/src/core/lib/security/security_connector/security_connector.h +102 -105
  139. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +348 -370
  140. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +14 -12
  141. data/src/core/lib/security/security_connector/ssl_utils.cc +13 -9
  142. data/src/core/lib/security/security_connector/ssl_utils.h +3 -1
  143. data/src/core/lib/security/transport/client_auth_filter.cc +50 -50
  144. data/src/core/lib/security/transport/secure_endpoint.cc +7 -1
  145. data/src/core/lib/security/transport/security_handshaker.cc +82 -66
  146. data/src/core/lib/security/transport/server_auth_filter.cc +15 -13
  147. data/src/core/lib/surface/init.cc +1 -0
  148. data/src/core/lib/surface/server.cc +13 -11
  149. data/src/core/lib/surface/server.h +6 -6
  150. data/src/core/lib/surface/version.cc +2 -2
  151. data/src/core/lib/transport/metadata.cc +1 -0
  152. data/src/core/lib/transport/static_metadata.cc +228 -221
  153. data/src/core/lib/transport/static_metadata.h +75 -71
  154. data/src/core/lib/transport/transport.cc +2 -1
  155. data/src/core/lib/transport/transport.h +5 -1
  156. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +9 -2
  157. data/src/core/tsi/ssl_transport_security.cc +35 -24
  158. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
  159. data/src/ruby/lib/grpc/generic/rpc_server.rb +61 -0
  160. data/src/ruby/lib/grpc/generic/service.rb +1 -1
  161. data/src/ruby/lib/grpc/version.rb +1 -1
  162. data/src/ruby/pb/grpc/health/checker.rb +2 -3
  163. data/src/ruby/spec/generic/rpc_server_spec.rb +22 -0
  164. data/src/ruby/spec/support/services.rb +1 -0
  165. metadata +37 -32
  166. data/src/core/ext/filters/client_channel/lb_policy_factory.cc +0 -163
@@ -0,0 +1,103 @@
1
+ /*
2
+ *
3
+ * Copyright 2018 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
+ #include <grpc/support/port_platform.h>
20
+
21
+ #include "src/core/ext/filters/client_channel/server_address.h"
22
+
23
+ #include <string.h>
24
+
25
+ namespace grpc_core {
26
+
27
+ //
28
+ // ServerAddress
29
+ //
30
+
31
+ ServerAddress::ServerAddress(const grpc_resolved_address& address,
32
+ grpc_channel_args* args)
33
+ : address_(address), args_(args) {}
34
+
35
+ ServerAddress::ServerAddress(const void* address, size_t address_len,
36
+ grpc_channel_args* args)
37
+ : args_(args) {
38
+ memcpy(address_.addr, address, address_len);
39
+ address_.len = static_cast<socklen_t>(address_len);
40
+ }
41
+
42
+ int ServerAddress::Cmp(const ServerAddress& other) const {
43
+ if (address_.len > other.address_.len) return 1;
44
+ if (address_.len < other.address_.len) return -1;
45
+ int retval = memcmp(address_.addr, other.address_.addr, address_.len);
46
+ if (retval != 0) return retval;
47
+ return grpc_channel_args_compare(args_, other.args_);
48
+ }
49
+
50
+ bool ServerAddress::IsBalancer() const {
51
+ return grpc_channel_arg_get_bool(
52
+ grpc_channel_args_find(args_, GRPC_ARG_ADDRESS_IS_BALANCER), false);
53
+ }
54
+
55
+ //
56
+ // ServerAddressList
57
+ //
58
+
59
+ namespace {
60
+
61
+ void* ServerAddressListCopy(void* addresses) {
62
+ ServerAddressList* a = static_cast<ServerAddressList*>(addresses);
63
+ return New<ServerAddressList>(*a);
64
+ }
65
+
66
+ void ServerAddressListDestroy(void* addresses) {
67
+ ServerAddressList* a = static_cast<ServerAddressList*>(addresses);
68
+ Delete(a);
69
+ }
70
+
71
+ int ServerAddressListCompare(void* addresses1, void* addresses2) {
72
+ ServerAddressList* a1 = static_cast<ServerAddressList*>(addresses1);
73
+ ServerAddressList* a2 = static_cast<ServerAddressList*>(addresses2);
74
+ if (a1->size() > a2->size()) return 1;
75
+ if (a1->size() < a2->size()) return -1;
76
+ for (size_t i = 0; i < a1->size(); ++i) {
77
+ int retval = (*a1)[i].Cmp((*a2)[i]);
78
+ if (retval != 0) return retval;
79
+ }
80
+ return 0;
81
+ }
82
+
83
+ const grpc_arg_pointer_vtable server_addresses_arg_vtable = {
84
+ ServerAddressListCopy, ServerAddressListDestroy, ServerAddressListCompare};
85
+
86
+ } // namespace
87
+
88
+ grpc_arg CreateServerAddressListChannelArg(const ServerAddressList* addresses) {
89
+ return grpc_channel_arg_pointer_create(
90
+ const_cast<char*>(GRPC_ARG_SERVER_ADDRESS_LIST),
91
+ const_cast<ServerAddressList*>(addresses), &server_addresses_arg_vtable);
92
+ }
93
+
94
+ ServerAddressList* FindServerAddressListChannelArg(
95
+ const grpc_channel_args* channel_args) {
96
+ const grpc_arg* lb_addresses_arg =
97
+ grpc_channel_args_find(channel_args, GRPC_ARG_SERVER_ADDRESS_LIST);
98
+ if (lb_addresses_arg == nullptr || lb_addresses_arg->type != GRPC_ARG_POINTER)
99
+ return nullptr;
100
+ return static_cast<ServerAddressList*>(lb_addresses_arg->value.pointer.p);
101
+ }
102
+
103
+ } // namespace grpc_core
@@ -0,0 +1,108 @@
1
+ /*
2
+ *
3
+ * Copyright 2018 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_FILTERS_CLIENT_CHANNEL_SERVER_ADDRESS_H
20
+ #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SERVER_ADDRESS_H
21
+
22
+ #include <grpc/support/port_platform.h>
23
+
24
+ #include "src/core/lib/channel/channel_args.h"
25
+ #include "src/core/lib/gprpp/inlined_vector.h"
26
+ #include "src/core/lib/iomgr/resolve_address.h"
27
+ #include "src/core/lib/uri/uri_parser.h"
28
+
29
+ // Channel arg key for ServerAddressList.
30
+ #define GRPC_ARG_SERVER_ADDRESS_LIST "grpc.server_address_list"
31
+
32
+ // Channel arg key for a bool indicating whether an address is a grpclb
33
+ // load balancer (as opposed to a backend).
34
+ #define GRPC_ARG_ADDRESS_IS_BALANCER "grpc.address_is_balancer"
35
+
36
+ // Channel arg key for a string indicating an address's balancer name.
37
+ #define GRPC_ARG_ADDRESS_BALANCER_NAME "grpc.address_balancer_name"
38
+
39
+ namespace grpc_core {
40
+
41
+ //
42
+ // ServerAddress
43
+ //
44
+
45
+ // A server address is a grpc_resolved_address with an associated set of
46
+ // channel args. Any args present here will be merged into the channel
47
+ // args when a subchannel is created for this address.
48
+ class ServerAddress {
49
+ public:
50
+ // Takes ownership of args.
51
+ ServerAddress(const grpc_resolved_address& address, grpc_channel_args* args);
52
+ ServerAddress(const void* address, size_t address_len,
53
+ grpc_channel_args* args);
54
+
55
+ ~ServerAddress() { grpc_channel_args_destroy(args_); }
56
+
57
+ // Copyable.
58
+ ServerAddress(const ServerAddress& other)
59
+ : address_(other.address_), args_(grpc_channel_args_copy(other.args_)) {}
60
+ ServerAddress& operator=(const ServerAddress& other) {
61
+ address_ = other.address_;
62
+ grpc_channel_args_destroy(args_);
63
+ args_ = grpc_channel_args_copy(other.args_);
64
+ return *this;
65
+ }
66
+
67
+ // Movable.
68
+ ServerAddress(ServerAddress&& other)
69
+ : address_(other.address_), args_(other.args_) {
70
+ other.args_ = nullptr;
71
+ }
72
+ ServerAddress& operator=(ServerAddress&& other) {
73
+ address_ = other.address_;
74
+ args_ = other.args_;
75
+ other.args_ = nullptr;
76
+ return *this;
77
+ }
78
+
79
+ bool operator==(const ServerAddress& other) const { return Cmp(other) == 0; }
80
+
81
+ int Cmp(const ServerAddress& other) const;
82
+
83
+ const grpc_resolved_address& address() const { return address_; }
84
+ const grpc_channel_args* args() const { return args_; }
85
+
86
+ bool IsBalancer() const;
87
+
88
+ private:
89
+ grpc_resolved_address address_;
90
+ grpc_channel_args* args_;
91
+ };
92
+
93
+ //
94
+ // ServerAddressList
95
+ //
96
+
97
+ typedef InlinedVector<ServerAddress, 1> ServerAddressList;
98
+
99
+ // Returns a channel arg containing \a addresses.
100
+ grpc_arg CreateServerAddressListChannelArg(const ServerAddressList* addresses);
101
+
102
+ // Returns the ServerListAddress instance in channel_args or NULL.
103
+ ServerAddressList* FindServerAddressListChannelArg(
104
+ const grpc_channel_args* channel_args);
105
+
106
+ } // namespace grpc_core
107
+
108
+ #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SERVER_ADDRESS_H */
@@ -153,7 +153,7 @@ struct grpc_subchannel {
153
153
  /** have we started the backoff loop */
154
154
  bool backoff_begun;
155
155
  // reset_backoff() was called while alarm was pending
156
- bool deferred_reset_backoff;
156
+ bool retry_immediately;
157
157
  /** our alarm */
158
158
  grpc_timer alarm;
159
159
 
@@ -709,8 +709,8 @@ static void on_alarm(void* arg, grpc_error* error) {
709
709
  if (c->disconnected) {
710
710
  error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING("Disconnected",
711
711
  &error, 1);
712
- } else if (c->deferred_reset_backoff) {
713
- c->deferred_reset_backoff = false;
712
+ } else if (c->retry_immediately) {
713
+ c->retry_immediately = false;
714
714
  error = GRPC_ERROR_NONE;
715
715
  } else {
716
716
  GRPC_ERROR_REF(error);
@@ -837,7 +837,7 @@ static bool publish_transport_locked(grpc_subchannel* c) {
837
837
 
838
838
  /* publish */
839
839
  c->connected_subchannel.reset(grpc_core::New<grpc_core::ConnectedSubchannel>(
840
- stk, c->channelz_subchannel, socket_uuid));
840
+ stk, c->args, c->channelz_subchannel, socket_uuid));
841
841
  gpr_log(GPR_INFO, "New connected subchannel at %p for subchannel %p",
842
842
  c->connected_subchannel.get(), c);
843
843
 
@@ -887,12 +887,12 @@ static void on_subchannel_connected(void* arg, grpc_error* error) {
887
887
 
888
888
  void grpc_subchannel_reset_backoff(grpc_subchannel* subchannel) {
889
889
  gpr_mu_lock(&subchannel->mu);
890
+ subchannel->backoff->Reset();
890
891
  if (subchannel->have_alarm) {
891
- subchannel->deferred_reset_backoff = true;
892
+ subchannel->retry_immediately = true;
892
893
  grpc_timer_cancel(&subchannel->alarm);
893
894
  } else {
894
895
  subchannel->backoff_begun = false;
895
- subchannel->backoff->Reset();
896
896
  maybe_start_connecting_locked(subchannel);
897
897
  }
898
898
  gpr_mu_unlock(&subchannel->mu);
@@ -1068,16 +1068,18 @@ grpc_arg grpc_create_subchannel_address_arg(const grpc_resolved_address* addr) {
1068
1068
  namespace grpc_core {
1069
1069
 
1070
1070
  ConnectedSubchannel::ConnectedSubchannel(
1071
- grpc_channel_stack* channel_stack,
1071
+ grpc_channel_stack* channel_stack, const grpc_channel_args* args,
1072
1072
  grpc_core::RefCountedPtr<grpc_core::channelz::SubchannelNode>
1073
1073
  channelz_subchannel,
1074
1074
  intptr_t socket_uuid)
1075
- : RefCountedWithTracing<ConnectedSubchannel>(&grpc_trace_stream_refcount),
1075
+ : RefCounted<ConnectedSubchannel>(&grpc_trace_stream_refcount),
1076
1076
  channel_stack_(channel_stack),
1077
+ args_(grpc_channel_args_copy(args)),
1077
1078
  channelz_subchannel_(std::move(channelz_subchannel)),
1078
1079
  socket_uuid_(socket_uuid) {}
1079
1080
 
1080
1081
  ConnectedSubchannel::~ConnectedSubchannel() {
1082
+ grpc_channel_args_destroy(args_);
1081
1083
  GRPC_CHANNEL_STACK_UNREF(channel_stack_, "connected_subchannel_dtor");
1082
1084
  }
1083
1085
 
@@ -72,7 +72,7 @@ typedef struct grpc_subchannel_key grpc_subchannel_key;
72
72
 
73
73
  namespace grpc_core {
74
74
 
75
- class ConnectedSubchannel : public RefCountedWithTracing<ConnectedSubchannel> {
75
+ class ConnectedSubchannel : public RefCounted<ConnectedSubchannel> {
76
76
  public:
77
77
  struct CallArgs {
78
78
  grpc_polling_entity* pollent;
@@ -85,28 +85,31 @@ class ConnectedSubchannel : public RefCountedWithTracing<ConnectedSubchannel> {
85
85
  size_t parent_data_size;
86
86
  };
87
87
 
88
- explicit ConnectedSubchannel(
89
- grpc_channel_stack* channel_stack,
88
+ ConnectedSubchannel(
89
+ grpc_channel_stack* channel_stack, const grpc_channel_args* args,
90
90
  grpc_core::RefCountedPtr<grpc_core::channelz::SubchannelNode>
91
91
  channelz_subchannel,
92
92
  intptr_t socket_uuid);
93
93
  ~ConnectedSubchannel();
94
94
 
95
- grpc_channel_stack* channel_stack() { return channel_stack_; }
96
95
  void NotifyOnStateChange(grpc_pollset_set* interested_parties,
97
96
  grpc_connectivity_state* state,
98
97
  grpc_closure* closure);
99
98
  void Ping(grpc_closure* on_initiate, grpc_closure* on_ack);
100
99
  grpc_error* CreateCall(const CallArgs& args, grpc_subchannel_call** call);
101
- channelz::SubchannelNode* channelz_subchannel() {
100
+
101
+ grpc_channel_stack* channel_stack() const { return channel_stack_; }
102
+ const grpc_channel_args* args() const { return args_; }
103
+ channelz::SubchannelNode* channelz_subchannel() const {
102
104
  return channelz_subchannel_.get();
103
105
  }
104
- intptr_t socket_uuid() { return socket_uuid_; }
106
+ intptr_t socket_uuid() const { return socket_uuid_; }
105
107
 
106
108
  size_t GetInitialCallSizeEstimate(size_t parent_data_size) const;
107
109
 
108
110
  private:
109
111
  grpc_channel_stack* channel_stack_;
112
+ grpc_channel_args* args_;
110
113
  // ref counted pointer to the channelz node in this connected subchannel's
111
114
  // owning subchannel.
112
115
  grpc_core::RefCountedPtr<grpc_core::channelz::SubchannelNode>
@@ -91,7 +91,7 @@ void grpc_subchannel_key_destroy(grpc_subchannel_key* k) {
91
91
  gpr_free(k);
92
92
  }
93
93
 
94
- static void sck_avl_destroy(void* p, void* user_data) {
94
+ static void sck_avl_destroy(void* p, void* unused) {
95
95
  grpc_subchannel_key_destroy(static_cast<grpc_subchannel_key*>(p));
96
96
  }
97
97
 
@@ -104,7 +104,7 @@ static long sck_avl_compare(void* a, void* b, void* unused) {
104
104
  static_cast<grpc_subchannel_key*>(b));
105
105
  }
106
106
 
107
- static void scv_avl_destroy(void* p, void* user_data) {
107
+ static void scv_avl_destroy(void* p, void* unused) {
108
108
  GRPC_SUBCHANNEL_WEAK_UNREF((grpc_subchannel*)p, "subchannel_index");
109
109
  }
110
110
 
@@ -137,7 +137,7 @@ void grpc_subchannel_index_shutdown(void) {
137
137
  void grpc_subchannel_index_unref(void) {
138
138
  if (gpr_unref(&g_refcount)) {
139
139
  gpr_mu_destroy(&g_mu);
140
- grpc_avl_unref(g_subchannel_index, grpc_core::ExecCtx::Get());
140
+ grpc_avl_unref(g_subchannel_index, nullptr);
141
141
  }
142
142
  }
143
143
 
@@ -147,13 +147,12 @@ grpc_subchannel* grpc_subchannel_index_find(grpc_subchannel_key* key) {
147
147
  // Lock, and take a reference to the subchannel index.
148
148
  // We don't need to do the search under a lock as avl's are immutable.
149
149
  gpr_mu_lock(&g_mu);
150
- grpc_avl index = grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
150
+ grpc_avl index = grpc_avl_ref(g_subchannel_index, nullptr);
151
151
  gpr_mu_unlock(&g_mu);
152
152
 
153
153
  grpc_subchannel* c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(
154
- (grpc_subchannel*)grpc_avl_get(index, key, grpc_core::ExecCtx::Get()),
155
- "index_find");
156
- grpc_avl_unref(index, grpc_core::ExecCtx::Get());
154
+ (grpc_subchannel*)grpc_avl_get(index, key, nullptr), "index_find");
155
+ grpc_avl_unref(index, nullptr);
157
156
 
158
157
  return c;
159
158
  }
@@ -169,13 +168,11 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
169
168
  // Compare and swap loop:
170
169
  // - take a reference to the current index
171
170
  gpr_mu_lock(&g_mu);
172
- grpc_avl index =
173
- grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
171
+ grpc_avl index = grpc_avl_ref(g_subchannel_index, nullptr);
174
172
  gpr_mu_unlock(&g_mu);
175
173
 
176
174
  // - Check to see if a subchannel already exists
177
- c = static_cast<grpc_subchannel*>(
178
- grpc_avl_get(index, key, grpc_core::ExecCtx::Get()));
175
+ c = static_cast<grpc_subchannel*>(grpc_avl_get(index, key, nullptr));
179
176
  if (c != nullptr) {
180
177
  c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register");
181
178
  }
@@ -184,11 +181,9 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
184
181
  need_to_unref_constructed = true;
185
182
  } else {
186
183
  // no -> update the avl and compare/swap
187
- grpc_avl updated =
188
- grpc_avl_add(grpc_avl_ref(index, grpc_core::ExecCtx::Get()),
189
- subchannel_key_copy(key),
190
- GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"),
191
- grpc_core::ExecCtx::Get());
184
+ grpc_avl updated = grpc_avl_add(
185
+ grpc_avl_ref(index, nullptr), subchannel_key_copy(key),
186
+ GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"), nullptr);
192
187
 
193
188
  // it may happen (but it's expected to be unlikely)
194
189
  // that some other thread has changed the index:
@@ -200,9 +195,9 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
200
195
  }
201
196
  gpr_mu_unlock(&g_mu);
202
197
 
203
- grpc_avl_unref(updated, grpc_core::ExecCtx::Get());
198
+ grpc_avl_unref(updated, nullptr);
204
199
  }
205
- grpc_avl_unref(index, grpc_core::ExecCtx::Get());
200
+ grpc_avl_unref(index, nullptr);
206
201
  }
207
202
 
208
203
  if (need_to_unref_constructed) {
@@ -219,24 +214,22 @@ void grpc_subchannel_index_unregister(grpc_subchannel_key* key,
219
214
  // Compare and swap loop:
220
215
  // - take a reference to the current index
221
216
  gpr_mu_lock(&g_mu);
222
- grpc_avl index =
223
- grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
217
+ grpc_avl index = grpc_avl_ref(g_subchannel_index, nullptr);
224
218
  gpr_mu_unlock(&g_mu);
225
219
 
226
220
  // Check to see if this key still refers to the previously
227
221
  // registered subchannel
228
- grpc_subchannel* c = static_cast<grpc_subchannel*>(
229
- grpc_avl_get(index, key, grpc_core::ExecCtx::Get()));
222
+ grpc_subchannel* c =
223
+ static_cast<grpc_subchannel*>(grpc_avl_get(index, key, nullptr));
230
224
  if (c != constructed) {
231
- grpc_avl_unref(index, grpc_core::ExecCtx::Get());
225
+ grpc_avl_unref(index, nullptr);
232
226
  break;
233
227
  }
234
228
 
235
229
  // compare and swap the update (some other thread may have
236
230
  // mutated the index behind us)
237
231
  grpc_avl updated =
238
- grpc_avl_remove(grpc_avl_ref(index, grpc_core::ExecCtx::Get()), key,
239
- grpc_core::ExecCtx::Get());
232
+ grpc_avl_remove(grpc_avl_ref(index, nullptr), key, nullptr);
240
233
 
241
234
  gpr_mu_lock(&g_mu);
242
235
  if (index.root == g_subchannel_index.root) {
@@ -245,8 +238,8 @@ void grpc_subchannel_index_unregister(grpc_subchannel_key* key,
245
238
  }
246
239
  gpr_mu_unlock(&g_mu);
247
240
 
248
- grpc_avl_unref(updated, grpc_core::ExecCtx::Get());
249
- grpc_avl_unref(index, grpc_core::ExecCtx::Get());
241
+ grpc_avl_unref(updated, nullptr);
242
+ grpc_avl_unref(index, nullptr);
250
243
  }
251
244
  }
252
245
 
@@ -117,8 +117,9 @@ static void on_handshake_done(void* arg, grpc_error* error) {
117
117
  c->args.interested_parties);
118
118
  c->result->transport =
119
119
  grpc_create_chttp2_transport(args->args, args->endpoint, true);
120
- c->result->socket_uuid =
121
- grpc_chttp2_transport_get_socket_uuid(c->result->transport);
120
+ grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> socket_node =
121
+ grpc_chttp2_transport_get_socket_node(c->result->transport);
122
+ c->result->socket_uuid = socket_node == nullptr ? 0 : socket_node->uuid();
122
123
  GPR_ASSERT(c->result->transport);
123
124
  // TODO(roth): We ideally want to wait until we receive HTTP/2
124
125
  // settings from the server before we consider the connection