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
@@ -31,7 +31,7 @@
31
31
 
32
32
  #include "src/core/lib/transport/metadata.h"
33
33
 
34
- #define GRPC_STATIC_MDSTR_COUNT 106
34
+ #define GRPC_STATIC_MDSTR_COUNT 107
35
35
  extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
36
36
  /* ":path" */
37
37
  #define GRPC_MDSTR_PATH (grpc_static_slice_table[0])
@@ -110,147 +110,151 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
110
110
  /* "/grpc.health.v1.Health/Watch" */
111
111
  #define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \
112
112
  (grpc_static_slice_table[35])
113
+ /* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources"
114
+ */
115
+ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \
116
+ (grpc_static_slice_table[36])
113
117
  /* "deflate" */
114
- #define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[36])
118
+ #define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[37])
115
119
  /* "gzip" */
116
- #define GRPC_MDSTR_GZIP (grpc_static_slice_table[37])
120
+ #define GRPC_MDSTR_GZIP (grpc_static_slice_table[38])
117
121
  /* "stream/gzip" */
118
- #define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[38])
122
+ #define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[39])
119
123
  /* "GET" */
120
- #define GRPC_MDSTR_GET (grpc_static_slice_table[39])
124
+ #define GRPC_MDSTR_GET (grpc_static_slice_table[40])
121
125
  /* "POST" */
122
- #define GRPC_MDSTR_POST (grpc_static_slice_table[40])
126
+ #define GRPC_MDSTR_POST (grpc_static_slice_table[41])
123
127
  /* "/" */
124
- #define GRPC_MDSTR_SLASH (grpc_static_slice_table[41])
128
+ #define GRPC_MDSTR_SLASH (grpc_static_slice_table[42])
125
129
  /* "/index.html" */
126
- #define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[42])
130
+ #define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[43])
127
131
  /* "http" */
128
- #define GRPC_MDSTR_HTTP (grpc_static_slice_table[43])
132
+ #define GRPC_MDSTR_HTTP (grpc_static_slice_table[44])
129
133
  /* "https" */
130
- #define GRPC_MDSTR_HTTPS (grpc_static_slice_table[44])
134
+ #define GRPC_MDSTR_HTTPS (grpc_static_slice_table[45])
131
135
  /* "200" */
132
- #define GRPC_MDSTR_200 (grpc_static_slice_table[45])
136
+ #define GRPC_MDSTR_200 (grpc_static_slice_table[46])
133
137
  /* "204" */
134
- #define GRPC_MDSTR_204 (grpc_static_slice_table[46])
138
+ #define GRPC_MDSTR_204 (grpc_static_slice_table[47])
135
139
  /* "206" */
136
- #define GRPC_MDSTR_206 (grpc_static_slice_table[47])
140
+ #define GRPC_MDSTR_206 (grpc_static_slice_table[48])
137
141
  /* "304" */
138
- #define GRPC_MDSTR_304 (grpc_static_slice_table[48])
142
+ #define GRPC_MDSTR_304 (grpc_static_slice_table[49])
139
143
  /* "400" */
140
- #define GRPC_MDSTR_400 (grpc_static_slice_table[49])
144
+ #define GRPC_MDSTR_400 (grpc_static_slice_table[50])
141
145
  /* "404" */
142
- #define GRPC_MDSTR_404 (grpc_static_slice_table[50])
146
+ #define GRPC_MDSTR_404 (grpc_static_slice_table[51])
143
147
  /* "500" */
144
- #define GRPC_MDSTR_500 (grpc_static_slice_table[51])
148
+ #define GRPC_MDSTR_500 (grpc_static_slice_table[52])
145
149
  /* "accept-charset" */
146
- #define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[52])
150
+ #define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[53])
147
151
  /* "gzip, deflate" */
148
- #define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[53])
152
+ #define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[54])
149
153
  /* "accept-language" */
150
- #define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[54])
154
+ #define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[55])
151
155
  /* "accept-ranges" */
152
- #define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[55])
156
+ #define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[56])
153
157
  /* "accept" */
154
- #define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[56])
158
+ #define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[57])
155
159
  /* "access-control-allow-origin" */
156
- #define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[57])
160
+ #define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[58])
157
161
  /* "age" */
158
- #define GRPC_MDSTR_AGE (grpc_static_slice_table[58])
162
+ #define GRPC_MDSTR_AGE (grpc_static_slice_table[59])
159
163
  /* "allow" */
160
- #define GRPC_MDSTR_ALLOW (grpc_static_slice_table[59])
164
+ #define GRPC_MDSTR_ALLOW (grpc_static_slice_table[60])
161
165
  /* "authorization" */
162
- #define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[60])
166
+ #define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[61])
163
167
  /* "cache-control" */
164
- #define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[61])
168
+ #define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[62])
165
169
  /* "content-disposition" */
166
- #define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[62])
170
+ #define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[63])
167
171
  /* "content-language" */
168
- #define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[63])
172
+ #define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[64])
169
173
  /* "content-length" */
170
- #define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[64])
174
+ #define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[65])
171
175
  /* "content-location" */
172
- #define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[65])
176
+ #define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[66])
173
177
  /* "content-range" */
174
- #define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[66])
178
+ #define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[67])
175
179
  /* "cookie" */
176
- #define GRPC_MDSTR_COOKIE (grpc_static_slice_table[67])
180
+ #define GRPC_MDSTR_COOKIE (grpc_static_slice_table[68])
177
181
  /* "date" */
178
- #define GRPC_MDSTR_DATE (grpc_static_slice_table[68])
182
+ #define GRPC_MDSTR_DATE (grpc_static_slice_table[69])
179
183
  /* "etag" */
180
- #define GRPC_MDSTR_ETAG (grpc_static_slice_table[69])
184
+ #define GRPC_MDSTR_ETAG (grpc_static_slice_table[70])
181
185
  /* "expect" */
182
- #define GRPC_MDSTR_EXPECT (grpc_static_slice_table[70])
186
+ #define GRPC_MDSTR_EXPECT (grpc_static_slice_table[71])
183
187
  /* "expires" */
184
- #define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[71])
188
+ #define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[72])
185
189
  /* "from" */
186
- #define GRPC_MDSTR_FROM (grpc_static_slice_table[72])
190
+ #define GRPC_MDSTR_FROM (grpc_static_slice_table[73])
187
191
  /* "if-match" */
188
- #define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[73])
192
+ #define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[74])
189
193
  /* "if-modified-since" */
190
- #define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[74])
194
+ #define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[75])
191
195
  /* "if-none-match" */
192
- #define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[75])
196
+ #define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[76])
193
197
  /* "if-range" */
194
- #define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[76])
198
+ #define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[77])
195
199
  /* "if-unmodified-since" */
196
- #define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[77])
200
+ #define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[78])
197
201
  /* "last-modified" */
198
- #define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[78])
202
+ #define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[79])
199
203
  /* "link" */
200
- #define GRPC_MDSTR_LINK (grpc_static_slice_table[79])
204
+ #define GRPC_MDSTR_LINK (grpc_static_slice_table[80])
201
205
  /* "location" */
202
- #define GRPC_MDSTR_LOCATION (grpc_static_slice_table[80])
206
+ #define GRPC_MDSTR_LOCATION (grpc_static_slice_table[81])
203
207
  /* "max-forwards" */
204
- #define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[81])
208
+ #define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[82])
205
209
  /* "proxy-authenticate" */
206
- #define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[82])
210
+ #define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[83])
207
211
  /* "proxy-authorization" */
208
- #define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[83])
212
+ #define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[84])
209
213
  /* "range" */
210
- #define GRPC_MDSTR_RANGE (grpc_static_slice_table[84])
214
+ #define GRPC_MDSTR_RANGE (grpc_static_slice_table[85])
211
215
  /* "referer" */
212
- #define GRPC_MDSTR_REFERER (grpc_static_slice_table[85])
216
+ #define GRPC_MDSTR_REFERER (grpc_static_slice_table[86])
213
217
  /* "refresh" */
214
- #define GRPC_MDSTR_REFRESH (grpc_static_slice_table[86])
218
+ #define GRPC_MDSTR_REFRESH (grpc_static_slice_table[87])
215
219
  /* "retry-after" */
216
- #define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[87])
220
+ #define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[88])
217
221
  /* "server" */
218
- #define GRPC_MDSTR_SERVER (grpc_static_slice_table[88])
222
+ #define GRPC_MDSTR_SERVER (grpc_static_slice_table[89])
219
223
  /* "set-cookie" */
220
- #define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[89])
224
+ #define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[90])
221
225
  /* "strict-transport-security" */
222
- #define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[90])
226
+ #define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[91])
223
227
  /* "transfer-encoding" */
224
- #define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[91])
228
+ #define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[92])
225
229
  /* "vary" */
226
- #define GRPC_MDSTR_VARY (grpc_static_slice_table[92])
230
+ #define GRPC_MDSTR_VARY (grpc_static_slice_table[93])
227
231
  /* "via" */
228
- #define GRPC_MDSTR_VIA (grpc_static_slice_table[93])
232
+ #define GRPC_MDSTR_VIA (grpc_static_slice_table[94])
229
233
  /* "www-authenticate" */
230
- #define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[94])
234
+ #define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[95])
231
235
  /* "0" */
232
- #define GRPC_MDSTR_0 (grpc_static_slice_table[95])
236
+ #define GRPC_MDSTR_0 (grpc_static_slice_table[96])
233
237
  /* "identity" */
234
- #define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[96])
238
+ #define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[97])
235
239
  /* "trailers" */
236
- #define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[97])
240
+ #define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[98])
237
241
  /* "application/grpc" */
238
- #define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[98])
242
+ #define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[99])
239
243
  /* "grpc" */
240
- #define GRPC_MDSTR_GRPC (grpc_static_slice_table[99])
244
+ #define GRPC_MDSTR_GRPC (grpc_static_slice_table[100])
241
245
  /* "PUT" */
242
- #define GRPC_MDSTR_PUT (grpc_static_slice_table[100])
246
+ #define GRPC_MDSTR_PUT (grpc_static_slice_table[101])
243
247
  /* "lb-cost-bin" */
244
- #define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[101])
248
+ #define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[102])
245
249
  /* "identity,deflate" */
246
- #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[102])
250
+ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[103])
247
251
  /* "identity,gzip" */
248
- #define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[103])
252
+ #define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[104])
249
253
  /* "deflate,gzip" */
250
- #define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[104])
254
+ #define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[105])
251
255
  /* "identity,deflate,gzip" */
252
256
  #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
253
- (grpc_static_slice_table[105])
257
+ (grpc_static_slice_table[106])
254
258
 
255
259
  extern const grpc_slice_refcount_vtable grpc_static_metadata_vtable;
256
260
  extern grpc_slice_refcount
@@ -27,6 +27,7 @@
27
27
  #include <grpc/support/log.h>
28
28
  #include <grpc/support/sync.h>
29
29
 
30
+ #include "src/core/lib/gpr/alloc.h"
30
31
  #include "src/core/lib/gpr/string.h"
31
32
  #include "src/core/lib/iomgr/executor.h"
32
33
  #include "src/core/lib/slice/slice_internal.h"
@@ -149,7 +150,7 @@ void grpc_transport_move_stats(grpc_transport_stream_stats* from,
149
150
  }
150
151
 
151
152
  size_t grpc_transport_stream_size(grpc_transport* transport) {
152
- return transport->vtable->sizeof_stream;
153
+ return GPR_ROUND_UP_TO_ALIGNMENT_SIZE(transport->vtable->sizeof_stream);
153
154
  }
154
155
 
155
156
  void grpc_transport_destroy(grpc_transport* transport) {
@@ -129,7 +129,8 @@ struct grpc_transport_stream_op_batch {
129
129
  recv_initial_metadata(false),
130
130
  recv_message(false),
131
131
  recv_trailing_metadata(false),
132
- cancel_stream(false) {}
132
+ cancel_stream(false),
133
+ is_traced(false) {}
133
134
 
134
135
  /** Should be scheduled when all of the non-recv operations in the batch
135
136
  are complete.
@@ -167,6 +168,9 @@ struct grpc_transport_stream_op_batch {
167
168
  /** Cancel this stream with the provided error */
168
169
  bool cancel_stream : 1;
169
170
 
171
+ /** Is this stream traced */
172
+ bool is_traced : 1;
173
+
170
174
  /***************************************************************************
171
175
  * remaining fields are initialized and used at the discretion of the
172
176
  * current handler of the op */
@@ -116,12 +116,13 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
116
116
  "cb is nullptr in alts_tsi_handshaker_handle_response()");
117
117
  return;
118
118
  }
119
- if (handshaker == nullptr || recv_buffer == nullptr) {
119
+ if (handshaker == nullptr) {
120
120
  gpr_log(GPR_ERROR,
121
- "Invalid arguments to alts_tsi_handshaker_handle_response()");
121
+ "handshaker is nullptr in alts_tsi_handshaker_handle_response()");
122
122
  cb(TSI_INTERNAL_ERROR, user_data, nullptr, 0, nullptr);
123
123
  return;
124
124
  }
125
+ /* TSI handshake has been shutdown. */
125
126
  if (alts_tsi_handshaker_has_shutdown(handshaker)) {
126
127
  gpr_log(GPR_ERROR, "TSI handshake shutdown");
127
128
  cb(TSI_HANDSHAKE_SHUTDOWN, user_data, nullptr, 0, nullptr);
@@ -133,6 +134,12 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
133
134
  cb(TSI_INTERNAL_ERROR, user_data, nullptr, 0, nullptr);
134
135
  return;
135
136
  }
137
+ if (recv_buffer == nullptr) {
138
+ gpr_log(GPR_ERROR,
139
+ "recv_buffer is nullptr in alts_tsi_handshaker_handle_response()");
140
+ cb(TSI_INTERNAL_ERROR, user_data, nullptr, 0, nullptr);
141
+ return;
142
+ }
136
143
  grpc_gcp_handshaker_resp* resp =
137
144
  alts_tsi_utils_deserialize_response(recv_buffer);
138
145
  grpc_byte_buffer_destroy(client->recv_buffer);
@@ -156,9 +156,13 @@ static unsigned long openssl_thread_id_cb(void) {
156
156
  #endif
157
157
 
158
158
  static void init_openssl(void) {
159
+ #if OPENSSL_API_COMPAT >= 0x10100000L
160
+ OPENSSL_init_ssl(0, NULL);
161
+ #else
159
162
  SSL_library_init();
160
163
  SSL_load_error_strings();
161
164
  OpenSSL_add_all_algorithms();
165
+ #endif
162
166
  #if OPENSSL_VERSION_NUMBER < 0x10100000
163
167
  if (!CRYPTO_get_locking_callback()) {
164
168
  int num_locks = CRYPTO_num_locks();
@@ -1649,7 +1653,11 @@ tsi_result tsi_create_ssl_client_handshaker_factory_with_options(
1649
1653
  return TSI_INVALID_ARGUMENT;
1650
1654
  }
1651
1655
 
1656
+ #if defined(OPENSSL_NO_TLS1_2_METHOD) || OPENSSL_API_COMPAT >= 0x10100000L
1657
+ ssl_context = SSL_CTX_new(TLS_method());
1658
+ #else
1652
1659
  ssl_context = SSL_CTX_new(TLSv1_2_method());
1660
+ #endif
1653
1661
  if (ssl_context == nullptr) {
1654
1662
  gpr_log(GPR_ERROR, "Could not create ssl context.");
1655
1663
  return TSI_INVALID_ARGUMENT;
@@ -1806,7 +1814,11 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
1806
1814
 
1807
1815
  for (i = 0; i < options->num_key_cert_pairs; i++) {
1808
1816
  do {
1817
+ #if defined(OPENSSL_NO_TLS1_2_METHOD) || OPENSSL_API_COMPAT >= 0x10100000L
1818
+ impl->ssl_contexts[i] = SSL_CTX_new(TLS_method());
1819
+ #else
1809
1820
  impl->ssl_contexts[i] = SSL_CTX_new(TLSv1_2_method());
1821
+ #endif
1810
1822
  if (impl->ssl_contexts[i] == nullptr) {
1811
1823
  gpr_log(GPR_ERROR, "Could not create ssl context.");
1812
1824
  result = TSI_OUT_OF_RESOURCES;
@@ -1850,31 +1862,30 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
1850
1862
  break;
1851
1863
  }
1852
1864
  SSL_CTX_set_client_CA_list(impl->ssl_contexts[i], root_names);
1853
- switch (options->client_certificate_request) {
1854
- case TSI_DONT_REQUEST_CLIENT_CERTIFICATE:
1855
- SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_NONE, nullptr);
1856
- break;
1857
- case TSI_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY:
1858
- SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_PEER,
1859
- NullVerifyCallback);
1860
- break;
1861
- case TSI_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY:
1862
- SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_PEER, nullptr);
1863
- break;
1864
- case TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY:
1865
- SSL_CTX_set_verify(
1866
- impl->ssl_contexts[i],
1867
- SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
1868
- NullVerifyCallback);
1869
- break;
1870
- case TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY:
1871
- SSL_CTX_set_verify(
1872
- impl->ssl_contexts[i],
1873
- SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, nullptr);
1874
- break;
1875
- }
1876
- /* TODO(jboeuf): Add revocation verification. */
1877
1865
  }
1866
+ switch (options->client_certificate_request) {
1867
+ case TSI_DONT_REQUEST_CLIENT_CERTIFICATE:
1868
+ SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_NONE, nullptr);
1869
+ break;
1870
+ case TSI_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY:
1871
+ SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_PEER,
1872
+ NullVerifyCallback);
1873
+ break;
1874
+ case TSI_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY:
1875
+ SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_PEER, nullptr);
1876
+ break;
1877
+ case TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY:
1878
+ SSL_CTX_set_verify(impl->ssl_contexts[i],
1879
+ SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
1880
+ NullVerifyCallback);
1881
+ break;
1882
+ case TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY:
1883
+ SSL_CTX_set_verify(impl->ssl_contexts[i],
1884
+ SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
1885
+ nullptr);
1886
+ break;
1887
+ }
1888
+ /* TODO(jboeuf): Add revocation verification. */
1878
1889
 
1879
1890
  result = extract_x509_subject_names_from_pem_cert(
1880
1891
  options->pem_key_cert_pairs[i].cert_chain,
@@ -272,7 +272,7 @@ extern grpc_channelz_get_servers_type grpc_channelz_get_servers_import;
272
272
  typedef char*(*grpc_channelz_get_server_type)(intptr_t server_id);
273
273
  extern grpc_channelz_get_server_type grpc_channelz_get_server_import;
274
274
  #define grpc_channelz_get_server grpc_channelz_get_server_import
275
- typedef char*(*grpc_channelz_get_server_sockets_type)(intptr_t server_id, intptr_t start_socket_id);
275
+ typedef char*(*grpc_channelz_get_server_sockets_type)(intptr_t server_id, intptr_t start_socket_id, intptr_t max_results);
276
276
  extern grpc_channelz_get_server_sockets_type grpc_channelz_get_server_sockets_import;
277
277
  #define grpc_channelz_get_server_sockets grpc_channelz_get_server_sockets_import
278
278
  typedef char*(*grpc_channelz_get_channel_type)(intptr_t channel_id);
@@ -240,6 +240,13 @@ module GRPC
240
240
  # the call has no impact if the server is already stopped, otherwise
241
241
  # server's current call loop is it's last.
242
242
  def stop
243
+ # if called via run_till_terminated_or_interrupted,
244
+ # signal stop_server_thread and dont do anything
245
+ if @stop_server.nil? == false && @stop_server == false
246
+ @stop_server = true
247
+ @stop_server_cv.broadcast
248
+ return
249
+ end
243
250
  @run_mutex.synchronize do
244
251
  fail 'Cannot stop before starting' if @running_state == :not_started
245
252
  return if @running_state != :running
@@ -354,6 +361,60 @@ module GRPC
354
361
 
355
362
  alias_method :run_till_terminated, :run
356
363
 
364
+ # runs the server with signal handlers
365
+ # @param signals
366
+ # List of String, Integer or both representing signals that the user
367
+ # would like to send to the server for graceful shutdown
368
+ # @param wait_interval (optional)
369
+ # Integer seconds that user would like stop_server_thread to poll
370
+ # stop_server
371
+ def run_till_terminated_or_interrupted(signals, wait_interval = 60)
372
+ @stop_server = false
373
+ @stop_server_mu = Mutex.new
374
+ @stop_server_cv = ConditionVariable.new
375
+
376
+ @stop_server_thread = Thread.new do
377
+ loop do
378
+ break if @stop_server
379
+ @stop_server_mu.synchronize do
380
+ @stop_server_cv.wait(@stop_server_mu, wait_interval)
381
+ end
382
+ end
383
+
384
+ # stop is surrounded by mutex, should handle multiple calls to stop
385
+ # correctly
386
+ stop
387
+ end
388
+
389
+ valid_signals = Signal.list
390
+
391
+ # register signal handlers
392
+ signals.each do |sig|
393
+ # input validation
394
+ if sig.class == String
395
+ sig.upcase!
396
+ if sig.start_with?('SIG')
397
+ # cut out the SIG prefix to see if valid signal
398
+ sig = sig[3..-1]
399
+ end
400
+ end
401
+
402
+ # register signal traps for all valid signals
403
+ if valid_signals.value?(sig) || valid_signals.key?(sig)
404
+ Signal.trap(sig) do
405
+ @stop_server = true
406
+ @stop_server_cv.broadcast
407
+ end
408
+ else
409
+ fail "#{sig} not a valid signal"
410
+ end
411
+ end
412
+
413
+ run
414
+
415
+ @stop_server_thread.join
416
+ end
417
+
357
418
  # Sends RESOURCE_EXHAUSTED if there are too many unprocessed jobs
358
419
  def available?(an_rpc)
359
420
  return an_rpc if @pool.ready_for_work?