grpc 0.14.1 → 0.15.0

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 (277) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1398 -817
  3. data/include/grpc/compression.h +2 -1
  4. data/include/grpc/grpc.h +10 -1
  5. data/include/grpc/grpc_cronet.h +51 -0
  6. data/include/grpc/grpc_posix.h +70 -0
  7. data/include/grpc/impl/codegen/atm.h +2 -2
  8. data/include/grpc/impl/codegen/{atm_win32.h → atm_windows.h} +3 -3
  9. data/include/grpc/impl/codegen/compression_types.h +39 -5
  10. data/include/grpc/impl/codegen/connectivity_state.h +1 -1
  11. data/include/grpc/impl/codegen/grpc_types.h +10 -0
  12. data/include/grpc/impl/codegen/log.h +2 -1
  13. data/include/grpc/impl/codegen/port_platform.h +30 -12
  14. data/include/grpc/impl/codegen/slice_buffer.h +2 -3
  15. data/include/grpc/impl/codegen/sync.h +2 -2
  16. data/include/grpc/impl/codegen/{sync_win32.h → sync_windows.h} +3 -3
  17. data/include/grpc/support/{sync_win32.h → atm_windows.h} +4 -4
  18. data/include/grpc/support/avl.h +5 -0
  19. data/include/grpc/support/{log_win32.h → log_windows.h} +3 -3
  20. data/include/grpc/support/string_util.h +2 -1
  21. data/include/grpc/support/{atm_win32.h → sync_windows.h} +4 -4
  22. data/src/core/ext/census/gen/census.pb.c +179 -0
  23. data/src/core/ext/census/gen/census.pb.h +294 -0
  24. data/src/core/ext/census/grpc_filter.c +11 -7
  25. data/src/core/ext/client_config/channel_connectivity.c +28 -14
  26. data/src/core/ext/client_config/client_channel.c +77 -53
  27. data/src/core/ext/client_config/connector.h +1 -1
  28. data/src/core/ext/client_config/lb_policy.c +9 -6
  29. data/src/core/ext/client_config/lb_policy.h +9 -5
  30. data/src/core/ext/client_config/subchannel.c +58 -39
  31. data/src/core/ext/client_config/subchannel.h +3 -2
  32. data/src/core/ext/client_config/subchannel_call_holder.c +34 -19
  33. data/src/core/ext/client_config/subchannel_call_holder.h +2 -1
  34. data/src/core/ext/client_config/subchannel_index.c +20 -9
  35. data/src/core/ext/lb_policy/grpclb/load_balancer_api.c +7 -7
  36. data/src/core/ext/lb_policy/grpclb/load_balancer_api.h +5 -5
  37. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/{v0 → v1}/load_balancer.pb.c +29 -30
  38. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +178 -0
  39. data/src/core/ext/lb_policy/pick_first/pick_first.c +65 -45
  40. data/src/core/ext/lb_policy/round_robin/round_robin.c +84 -43
  41. data/src/core/ext/load_reporting/load_reporting.c +133 -0
  42. data/src/core/ext/load_reporting/load_reporting.h +75 -0
  43. data/src/core/ext/load_reporting/load_reporting_filter.c +151 -0
  44. data/src/core/ext/load_reporting/load_reporting_filter.h +41 -0
  45. data/src/core/ext/resolver/dns/native/dns_resolver.c +22 -8
  46. data/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +2 -2
  47. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +4 -4
  48. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +95 -0
  49. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +14 -18
  50. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +49 -24
  51. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +82 -0
  52. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +104 -60
  53. data/src/core/ext/transport/chttp2/transport/bin_decoder.c +232 -0
  54. data/src/{ruby/ext/grpc/rb_signal.c → core/ext/transport/chttp2/transport/bin_decoder.h} +27 -31
  55. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +481 -260
  56. data/src/core/ext/transport/chttp2/transport/frame.h +1 -7
  57. data/src/core/ext/transport/chttp2/transport/frame_data.c +44 -27
  58. data/src/core/ext/transport/chttp2/transport/frame_data.h +6 -5
  59. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +23 -17
  60. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -2
  61. data/src/core/ext/transport/chttp2/transport/frame_ping.c +12 -7
  62. data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -3
  63. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +25 -12
  64. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -2
  65. data/src/core/ext/transport/chttp2/transport/frame_settings.c +23 -21
  66. data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -2
  67. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +17 -9
  68. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -2
  69. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +365 -287
  70. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +8 -6
  71. data/src/core/ext/transport/chttp2/transport/hpack_table.c +24 -20
  72. data/src/core/ext/transport/chttp2/transport/hpack_table.h +5 -4
  73. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +1 -0
  74. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +1 -0
  75. data/src/core/ext/transport/chttp2/transport/internal.h +34 -32
  76. data/src/core/ext/transport/chttp2/transport/parsing.c +296 -212
  77. data/src/core/ext/transport/chttp2/transport/writing.c +12 -9
  78. data/src/core/lib/channel/channel_args.c +26 -12
  79. data/src/core/lib/channel/channel_args.h +1 -1
  80. data/src/core/lib/channel/channel_stack.c +12 -8
  81. data/src/core/lib/channel/channel_stack.h +27 -11
  82. data/src/core/lib/channel/channel_stack_builder.c +2 -2
  83. data/src/core/lib/channel/compress_filter.c +26 -31
  84. data/src/core/lib/channel/compress_filter.h +4 -4
  85. data/src/core/lib/channel/connected_channel.c +7 -5
  86. data/src/core/lib/channel/http_client_filter.c +34 -8
  87. data/src/core/lib/channel/http_client_filter.h +1 -1
  88. data/src/core/lib/channel/http_server_filter.c +21 -12
  89. data/src/core/lib/compression/{compression_algorithm.c → compression.c} +22 -21
  90. data/src/core/lib/http/httpcli.c +81 -59
  91. data/src/core/lib/http/httpcli.h +11 -15
  92. data/src/core/lib/http/httpcli_security_connector.c +5 -3
  93. data/src/core/lib/http/parser.c +127 -118
  94. data/src/core/lib/http/parser.h +11 -6
  95. data/src/core/lib/iomgr/closure.c +20 -16
  96. data/src/core/lib/iomgr/closure.h +19 -15
  97. data/src/core/lib/iomgr/endpoint.h +1 -1
  98. data/src/core/lib/iomgr/endpoint_pair_posix.c +2 -2
  99. data/src/core/lib/iomgr/error.c +535 -0
  100. data/src/core/lib/iomgr/error.h +192 -0
  101. data/src/core/lib/iomgr/ev_poll_and_epoll_posix.c +190 -83
  102. data/src/core/lib/iomgr/ev_poll_posix.c +1267 -0
  103. data/src/{ruby/ext/grpc/rb_signal.h → core/lib/iomgr/ev_poll_posix.h} +7 -5
  104. data/src/core/lib/iomgr/ev_posix.c +104 -14
  105. data/src/core/lib/iomgr/ev_posix.h +17 -7
  106. data/src/core/lib/iomgr/exec_ctx.c +25 -7
  107. data/src/core/lib/iomgr/exec_ctx.h +27 -8
  108. data/src/core/lib/iomgr/executor.c +2 -2
  109. data/src/core/lib/iomgr/executor.h +1 -1
  110. data/src/core/lib/iomgr/iocp_windows.c +2 -41
  111. data/src/core/lib/iomgr/iocp_windows.h +0 -8
  112. data/src/core/lib/iomgr/iomgr.c +5 -4
  113. data/src/core/lib/iomgr/iomgr_posix.c +5 -1
  114. data/src/core/lib/iomgr/iomgr_windows.c +1 -1
  115. data/src/core/lib/{support → iomgr}/load_file.c +15 -17
  116. data/src/core/lib/{support → iomgr}/load_file.h +8 -7
  117. data/src/core/lib/iomgr/polling_entity.c +104 -0
  118. data/src/core/lib/iomgr/polling_entity.h +81 -0
  119. data/src/core/lib/iomgr/pollset.h +6 -5
  120. data/src/core/lib/iomgr/pollset_set_windows.c +4 -1
  121. data/src/core/lib/iomgr/pollset_windows.c +10 -6
  122. data/src/core/lib/iomgr/resolve_address.h +5 -9
  123. data/src/core/lib/iomgr/resolve_address_posix.c +55 -38
  124. data/src/core/lib/iomgr/resolve_address_windows.c +51 -37
  125. data/src/core/lib/iomgr/sockaddr.h +2 -2
  126. data/src/core/lib/iomgr/{sockaddr_win32.h → sockaddr_windows.h} +3 -3
  127. data/src/core/lib/iomgr/socket_utils_common_posix.c +92 -45
  128. data/src/core/lib/iomgr/socket_utils_posix.h +19 -12
  129. data/src/core/lib/iomgr/socket_windows.c +61 -2
  130. data/src/core/lib/iomgr/socket_windows.h +13 -0
  131. data/src/core/lib/iomgr/tcp_client_posix.c +54 -39
  132. data/src/core/lib/iomgr/tcp_client_windows.c +34 -34
  133. data/src/core/lib/iomgr/tcp_posix.c +43 -39
  134. data/src/core/lib/iomgr/tcp_server.h +5 -3
  135. data/src/core/lib/iomgr/tcp_server_posix.c +103 -64
  136. data/src/core/lib/iomgr/tcp_server_windows.c +114 -101
  137. data/src/core/lib/iomgr/tcp_windows.c +45 -50
  138. data/src/core/lib/iomgr/tcp_windows.h +1 -1
  139. data/src/core/lib/iomgr/timer.c +26 -13
  140. data/src/core/lib/iomgr/udp_server.c +28 -4
  141. data/src/core/lib/iomgr/udp_server.h +5 -1
  142. data/src/core/lib/iomgr/unix_sockets_posix.c +8 -7
  143. data/src/core/lib/iomgr/unix_sockets_posix.h +2 -1
  144. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +4 -2
  145. data/src/core/lib/iomgr/wakeup_fd_eventfd.c +15 -5
  146. data/src/core/lib/iomgr/wakeup_fd_pipe.c +13 -9
  147. data/src/core/lib/iomgr/wakeup_fd_posix.c +6 -6
  148. data/src/core/lib/iomgr/wakeup_fd_posix.h +9 -6
  149. data/src/core/lib/iomgr/workqueue.h +5 -4
  150. data/src/core/lib/iomgr/workqueue_posix.c +40 -26
  151. data/src/core/lib/iomgr/workqueue_windows.c +2 -2
  152. data/src/core/lib/profiling/basic_timers.c +2 -2
  153. data/src/core/lib/security/{security_context.c → context/security_context.c} +1 -1
  154. data/src/core/lib/security/{security_context.h → context/security_context.h} +4 -4
  155. data/src/core/lib/security/credentials/composite/composite_credentials.c +263 -0
  156. data/src/core/lib/security/credentials/composite/composite_credentials.h +72 -0
  157. data/src/core/lib/security/credentials/credentials.c +233 -0
  158. data/src/core/lib/security/{credentials.h → credentials/credentials.h} +19 -157
  159. data/src/core/lib/security/{credentials_metadata.c → credentials/credentials_metadata.c} +1 -1
  160. data/src/core/lib/security/credentials/fake/fake_credentials.c +139 -0
  161. data/src/core/lib/security/credentials/fake/fake_credentials.h +56 -0
  162. data/src/core/lib/security/{credentials_posix.c → credentials/google_default/credentials_posix.c} +1 -1
  163. data/src/core/lib/security/{credentials_win32.c → credentials/google_default/credentials_windows.c} +3 -3
  164. data/src/core/lib/security/{google_default_credentials.c → credentials/google_default/google_default_credentials.c} +93 -35
  165. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +46 -0
  166. data/src/core/lib/security/credentials/iam/iam_credentials.c +85 -0
  167. data/src/core/lib/security/credentials/iam/iam_credentials.h +44 -0
  168. data/src/core/lib/security/{json_token.c → credentials/jwt/json_token.c} +10 -101
  169. data/src/core/lib/security/{json_token.h → credentials/jwt/json_token.h} +3 -33
  170. data/src/core/lib/security/credentials/jwt/jwt_credentials.c +160 -0
  171. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +62 -0
  172. data/src/core/lib/security/{jwt_verifier.c → credentials/jwt/jwt_verifier.c} +35 -15
  173. data/src/core/lib/security/{jwt_verifier.h → credentials/jwt/jwt_verifier.h} +3 -3
  174. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +433 -0
  175. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +109 -0
  176. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +129 -0
  177. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +45 -0
  178. data/src/core/lib/security/credentials/ssl/ssl_credentials.c +240 -0
  179. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +48 -0
  180. data/src/core/lib/security/{auth_filters.h → transport/auth_filters.h} +3 -3
  181. data/src/core/lib/security/{client_auth_filter.c → transport/client_auth_filter.c} +27 -20
  182. data/src/core/lib/security/{handshake.c → transport/handshake.c} +77 -45
  183. data/src/core/lib/security/{handshake.h → transport/handshake.h} +9 -11
  184. data/src/core/lib/security/{secure_endpoint.c → transport/secure_endpoint.c} +19 -12
  185. data/src/core/lib/security/{secure_endpoint.h → transport/secure_endpoint.h} +3 -3
  186. data/src/core/lib/security/{security_connector.c → transport/security_connector.c} +26 -17
  187. data/src/core/lib/security/{security_connector.h → transport/security_connector.h} +8 -8
  188. data/src/core/lib/security/{server_auth_filter.c → transport/server_auth_filter.c} +24 -16
  189. data/src/core/lib/security/transport/tsi_error.c +40 -0
  190. data/src/core/lib/security/transport/tsi_error.h +42 -0
  191. data/src/core/lib/security/{b64.c → util/b64.c} +1 -1
  192. data/src/core/lib/security/{b64.h → util/b64.h} +3 -3
  193. data/src/core/lib/security/util/json_util.c +61 -0
  194. data/src/core/lib/security/util/json_util.h +55 -0
  195. data/src/core/lib/support/avl.c +11 -0
  196. data/src/core/lib/support/cpu_windows.c +2 -2
  197. data/src/core/lib/support/{env_win32.c → env_windows.c} +3 -3
  198. data/src/core/lib/support/log.c +3 -1
  199. data/src/core/lib/support/log_linux.c +2 -2
  200. data/src/core/lib/support/{log_win32.c → log_windows.c} +4 -4
  201. data/src/core/lib/support/murmur_hash.c +3 -5
  202. data/src/core/lib/support/string.c +10 -0
  203. data/src/core/lib/support/string.h +4 -0
  204. data/src/core/lib/support/{string_util_win32.c → string_util_windows.c} +3 -3
  205. data/src/core/lib/support/{string_win32.c → string_windows.c} +2 -2
  206. data/src/core/lib/support/{string_win32.h → string_windows.h} +5 -5
  207. data/src/core/lib/support/subprocess_windows.c +1 -1
  208. data/src/core/lib/support/{sync_win32.c → sync_windows.c} +2 -2
  209. data/src/core/lib/support/{thd_win32.c → thd_windows.c} +2 -2
  210. data/src/core/lib/support/{time_win32.c → time_windows.c} +2 -2
  211. data/src/core/lib/support/tmpfile_msys.c +1 -1
  212. data/src/core/lib/support/{tmpfile_win32.c → tmpfile_windows.c} +3 -3
  213. data/src/core/lib/surface/alarm.c +2 -2
  214. data/src/core/lib/surface/byte_buffer_reader.c +13 -6
  215. data/src/core/lib/surface/call.c +323 -123
  216. data/src/core/lib/surface/call.h +2 -0
  217. data/src/core/lib/surface/call_log_batch.c +1 -1
  218. data/src/core/lib/surface/channel.c +64 -15
  219. data/src/core/lib/surface/channel.h +9 -0
  220. data/src/core/lib/surface/channel_ping.c +3 -3
  221. data/src/core/lib/surface/completion_queue.c +75 -19
  222. data/src/core/lib/surface/completion_queue.h +7 -2
  223. data/src/core/lib/surface/init.c +2 -1
  224. data/src/core/lib/surface/init_secure.c +4 -4
  225. data/src/core/lib/surface/lame_client.c +12 -8
  226. data/src/core/lib/surface/server.c +213 -120
  227. data/src/core/lib/surface/server.h +1 -0
  228. data/src/core/lib/surface/version.c +1 -1
  229. data/src/core/lib/transport/connectivity_state.c +40 -18
  230. data/src/core/lib/transport/connectivity_state.h +4 -1
  231. data/src/core/lib/transport/metadata.c +23 -23
  232. data/src/core/lib/transport/metadata.h +4 -0
  233. data/src/core/lib/transport/metadata_batch.c +9 -0
  234. data/src/core/lib/transport/metadata_batch.h +3 -0
  235. data/src/core/lib/transport/static_metadata.c +6 -5
  236. data/src/core/lib/transport/static_metadata.h +64 -60
  237. data/src/core/lib/transport/transport.c +24 -12
  238. data/src/core/lib/transport/transport.h +6 -5
  239. data/src/core/lib/transport/transport_impl.h +4 -0
  240. data/src/core/lib/transport/transport_op_string.c +2 -2
  241. data/src/core/plugin_registry/grpc_plugin_registry.c +4 -0
  242. data/src/ruby/bin/math_services.rb +41 -2
  243. data/src/ruby/ext/grpc/rb_call.c +42 -40
  244. data/src/ruby/ext/grpc/rb_channel.c +1 -1
  245. data/src/ruby/ext/grpc/rb_completion_queue.c +59 -6
  246. data/src/ruby/ext/grpc/rb_completion_queue.h +1 -1
  247. data/src/ruby/ext/grpc/rb_grpc.c +1 -3
  248. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -2
  249. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +21 -5
  250. data/src/ruby/ext/grpc/rb_loader.c +1 -1
  251. data/src/ruby/ext/grpc/rb_server.c +5 -3
  252. data/src/ruby/lib/grpc.rb +0 -3
  253. data/src/ruby/lib/grpc/errors.rb +3 -2
  254. data/src/ruby/lib/grpc/generic/active_call.rb +32 -42
  255. data/src/ruby/lib/grpc/generic/bidi_call.rb +20 -0
  256. data/src/ruby/lib/grpc/generic/client_stub.rb +31 -54
  257. data/src/ruby/lib/grpc/generic/rpc_desc.rb +4 -4
  258. data/src/ruby/lib/grpc/generic/rpc_server.rb +12 -23
  259. data/src/ruby/lib/grpc/generic/service.rb +8 -8
  260. data/src/ruby/lib/grpc/version.rb +1 -1
  261. data/src/ruby/pb/grpc/health/v1/health_services.rb +30 -2
  262. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services.rb +34 -4
  263. data/src/ruby/pb/grpc/testing/metrics_services.rb +39 -2
  264. data/src/ruby/pb/src/proto/grpc/testing/empty.rb +15 -0
  265. data/src/ruby/pb/src/proto/grpc/testing/messages.rb +84 -0
  266. data/src/ruby/pb/src/proto/grpc/testing/test.rb +14 -0
  267. data/src/ruby/pb/src/proto/grpc/testing/test_services.rb +110 -0
  268. data/src/ruby/pb/test/client.rb +5 -2
  269. data/src/ruby/spec/generic/active_call_spec.rb +3 -2
  270. data/src/ruby/spec/generic/client_stub_spec.rb +27 -24
  271. data/src/ruby/spec/generic/rpc_desc_spec.rb +11 -11
  272. data/src/ruby/spec/generic/rpc_server_spec.rb +42 -61
  273. data/src/ruby/spec/pb/health/checker_spec.rb +3 -5
  274. metadata +86 -48
  275. data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h +0 -182
  276. data/src/core/lib/security/credentials.c +0 -1296
  277. data/src/ruby/lib/grpc/signals.rb +0 -69
@@ -0,0 +1,151 @@
1
+ /*
2
+ *
3
+ * Copyright 2016, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #include <grpc/support/log.h>
35
+ #include <grpc/support/string_util.h>
36
+ #include <grpc/support/sync.h>
37
+ #include <string.h>
38
+
39
+ #include "src/core/ext/load_reporting/load_reporting.h"
40
+ #include "src/core/ext/load_reporting/load_reporting_filter.h"
41
+ #include "src/core/lib/channel/channel_args.h"
42
+ #include "src/core/lib/profiling/timers.h"
43
+ #include "src/core/lib/transport/static_metadata.h"
44
+
45
+ typedef struct call_data { const char *trailing_md_string; } call_data;
46
+ typedef struct channel_data {
47
+ gpr_mu mu;
48
+ grpc_load_reporting_config *lrc;
49
+ } channel_data;
50
+
51
+ static void invoke_lr_fn_locked(grpc_load_reporting_config *lrc,
52
+ grpc_load_reporting_call_data *lr_call_data) {
53
+ GPR_TIMER_BEGIN("load_reporting_config_fn", 0);
54
+ grpc_load_reporting_config_call(lrc, lr_call_data);
55
+ GPR_TIMER_END("load_reporting_config_fn", 0);
56
+ }
57
+
58
+ /* Constructor for call_data */
59
+ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
60
+ grpc_call_element_args *args) {
61
+ call_data *calld = elem->call_data;
62
+ memset(calld, 0, sizeof(call_data));
63
+ }
64
+
65
+ /* Destructor for call_data */
66
+ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
67
+ const grpc_call_stats *stats, void *ignored) {
68
+ channel_data *chand = elem->channel_data;
69
+ call_data *calld = elem->call_data;
70
+
71
+ grpc_load_reporting_call_data lr_call_data = {stats,
72
+ calld->trailing_md_string};
73
+
74
+ gpr_mu_lock(&chand->mu);
75
+ invoke_lr_fn_locked(chand->lrc, &lr_call_data);
76
+ gpr_mu_unlock(&chand->mu);
77
+ }
78
+
79
+ /* Constructor for channel_data */
80
+ static void init_channel_elem(grpc_exec_ctx *exec_ctx,
81
+ grpc_channel_element *elem,
82
+ grpc_channel_element_args *args) {
83
+ GPR_ASSERT(!args->is_last);
84
+
85
+ channel_data *chand = elem->channel_data;
86
+ memset(chand, 0, sizeof(channel_data));
87
+
88
+ gpr_mu_init(&chand->mu);
89
+ for (size_t i = 0; i < args->channel_args->num_args; i++) {
90
+ if (0 == strcmp(args->channel_args->args[i].key,
91
+ GRPC_ARG_ENABLE_LOAD_REPORTING)) {
92
+ grpc_load_reporting_config *arg_lrc =
93
+ args->channel_args->args[i].value.pointer.p;
94
+ chand->lrc = grpc_load_reporting_config_copy(arg_lrc);
95
+ GPR_ASSERT(chand->lrc != NULL);
96
+ break;
97
+ }
98
+ }
99
+ GPR_ASSERT(chand->lrc != NULL); /* arg actually found */
100
+
101
+ gpr_mu_lock(&chand->mu);
102
+ invoke_lr_fn_locked(chand->lrc, NULL);
103
+ gpr_mu_unlock(&chand->mu);
104
+ }
105
+
106
+ /* Destructor for channel data */
107
+ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
108
+ grpc_channel_element *elem) {
109
+ channel_data *chand = elem->channel_data;
110
+ gpr_mu_destroy(&chand->mu);
111
+ grpc_load_reporting_config_destroy(chand->lrc);
112
+ }
113
+
114
+ static grpc_mdelem *lr_trailing_md_filter(void *user_data, grpc_mdelem *md) {
115
+ grpc_call_element *elem = user_data;
116
+ call_data *calld = elem->call_data;
117
+
118
+ if (md->key == GRPC_MDSTR_LOAD_REPORTING) {
119
+ calld->trailing_md_string = gpr_strdup(grpc_mdstr_as_c_string(md->value));
120
+ return NULL;
121
+ }
122
+
123
+ return md;
124
+ }
125
+
126
+ static void lr_start_transport_stream_op(grpc_exec_ctx *exec_ctx,
127
+ grpc_call_element *elem,
128
+ grpc_transport_stream_op *op) {
129
+ GPR_TIMER_BEGIN("lr_start_transport_stream_op", 0);
130
+
131
+ if (op->send_trailing_metadata) {
132
+ grpc_metadata_batch_filter(op->send_trailing_metadata,
133
+ lr_trailing_md_filter, elem);
134
+ }
135
+ grpc_call_next_op(exec_ctx, elem, op);
136
+
137
+ GPR_TIMER_END("lr_start_transport_stream_op", 0);
138
+ }
139
+
140
+ const grpc_channel_filter grpc_load_reporting_filter = {
141
+ lr_start_transport_stream_op,
142
+ grpc_channel_next_op,
143
+ sizeof(call_data),
144
+ init_call_elem,
145
+ grpc_call_stack_ignore_set_pollset_or_pollset_set,
146
+ destroy_call_elem,
147
+ sizeof(channel_data),
148
+ init_channel_elem,
149
+ destroy_channel_elem,
150
+ grpc_call_next_get_peer,
151
+ "load_reporting"};
@@ -0,0 +1,41 @@
1
+ /*
2
+ *
3
+ * Copyright 2016, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #ifndef GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_FILTER_H
35
+ #define GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_FILTER_H
36
+
37
+ #include "src/core/lib/channel/channel_stack.h"
38
+
39
+ extern const grpc_channel_filter grpc_load_reporting_filter;
40
+
41
+ #endif /* GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_FILTER_H */
@@ -82,6 +82,9 @@ typedef struct {
82
82
  grpc_timer retry_timer;
83
83
  /** retry backoff state */
84
84
  gpr_backoff backoff_state;
85
+
86
+ /** currently resolving addresses */
87
+ grpc_resolved_addresses *addresses;
85
88
  } dns_resolver;
86
89
 
87
90
  static void dns_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
@@ -108,7 +111,8 @@ static void dns_shutdown(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver) {
108
111
  }
109
112
  if (r->next_completion != NULL) {
110
113
  *r->target_config = NULL;
111
- grpc_exec_ctx_enqueue(exec_ctx, r->next_completion, true, NULL);
114
+ grpc_exec_ctx_sched(exec_ctx, r->next_completion,
115
+ GRPC_ERROR_CREATE("Resolver Shutdown"), NULL);
112
116
  r->next_completion = NULL;
113
117
  }
114
118
  gpr_mu_unlock(&r->mu);
@@ -143,12 +147,12 @@ static void dns_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
143
147
  }
144
148
 
145
149
  static void dns_on_retry_timer(grpc_exec_ctx *exec_ctx, void *arg,
146
- bool success) {
150
+ grpc_error *error) {
147
151
  dns_resolver *r = arg;
148
152
 
149
153
  gpr_mu_lock(&r->mu);
150
154
  r->have_retry_timer = false;
151
- if (success) {
155
+ if (error == GRPC_ERROR_NONE) {
152
156
  if (!r->resolving) {
153
157
  dns_start_resolving_locked(exec_ctx, r);
154
158
  }
@@ -159,13 +163,14 @@ static void dns_on_retry_timer(grpc_exec_ctx *exec_ctx, void *arg,
159
163
  }
160
164
 
161
165
  static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
162
- grpc_resolved_addresses *addresses) {
166
+ grpc_error *error) {
163
167
  dns_resolver *r = arg;
164
168
  grpc_client_config *config = NULL;
165
169
  grpc_lb_policy *lb_policy;
166
170
  gpr_mu_lock(&r->mu);
167
171
  GPR_ASSERT(r->resolving);
168
172
  r->resolving = 0;
173
+ grpc_resolved_addresses *addresses = r->addresses;
169
174
  if (addresses != NULL) {
170
175
  grpc_lb_policy_args lb_policy_args;
171
176
  config = grpc_client_config_create();
@@ -183,11 +188,18 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
183
188
  gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
184
189
  gpr_timespec next_try = gpr_backoff_step(&r->backoff_state, now);
185
190
  gpr_timespec timeout = gpr_time_sub(next_try, now);
186
- gpr_log(GPR_DEBUG, "dns resolution failed: retrying in %d.%09d seconds",
187
- timeout.tv_sec, timeout.tv_nsec);
191
+ const char *msg = grpc_error_string(error);
192
+ gpr_log(GPR_DEBUG, "dns resolution failed: %s", msg);
193
+ grpc_error_free_string(msg);
188
194
  GPR_ASSERT(!r->have_retry_timer);
189
195
  r->have_retry_timer = true;
190
196
  GRPC_RESOLVER_REF(&r->base, "retry-timer");
197
+ if (gpr_time_cmp(timeout, gpr_time_0(timeout.clock_type)) <= 0) {
198
+ gpr_log(GPR_DEBUG, "retrying in %" PRId64 ".%09d seconds", timeout.tv_sec,
199
+ timeout.tv_nsec);
200
+ } else {
201
+ gpr_log(GPR_DEBUG, "retrying immediately");
202
+ }
191
203
  grpc_timer_init(exec_ctx, &r->retry_timer, next_try, dns_on_retry_timer, r,
192
204
  now);
193
205
  }
@@ -207,7 +219,9 @@ static void dns_start_resolving_locked(grpc_exec_ctx *exec_ctx,
207
219
  GRPC_RESOLVER_REF(&r->base, "dns-resolving");
208
220
  GPR_ASSERT(!r->resolving);
209
221
  r->resolving = 1;
210
- grpc_resolve_address(exec_ctx, r->name, r->default_port, dns_on_resolved, r);
222
+ r->addresses = NULL;
223
+ grpc_resolve_address(exec_ctx, r->name, r->default_port,
224
+ grpc_closure_create(dns_on_resolved, r), &r->addresses);
211
225
  }
212
226
 
213
227
  static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
@@ -218,7 +232,7 @@ static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
218
232
  if (r->resolved_config) {
219
233
  grpc_client_config_ref(r->resolved_config);
220
234
  }
221
- grpc_exec_ctx_enqueue(exec_ctx, r->next_completion, true, NULL);
235
+ grpc_exec_ctx_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE, NULL);
222
236
  r->next_completion = NULL;
223
237
  r->published_version = r->resolved_version;
224
238
  }
@@ -92,7 +92,7 @@ static void sockaddr_shutdown(grpc_exec_ctx *exec_ctx,
92
92
  gpr_mu_lock(&r->mu);
93
93
  if (r->next_completion != NULL) {
94
94
  *r->target_config = NULL;
95
- grpc_exec_ctx_enqueue(exec_ctx, r->next_completion, true, NULL);
95
+ grpc_exec_ctx_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE, NULL);
96
96
  r->next_completion = NULL;
97
97
  }
98
98
  gpr_mu_unlock(&r->mu);
@@ -133,7 +133,7 @@ static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
133
133
  GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "sockaddr");
134
134
  r->published = 1;
135
135
  *r->target_config = cfg;
136
- grpc_exec_ctx_enqueue(exec_ctx, r->next_completion, true, NULL);
136
+ grpc_exec_ctx_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE, NULL);
137
137
  r->next_completion = NULL;
138
138
  }
139
139
  }
@@ -79,11 +79,11 @@ static void connector_unref(grpc_exec_ctx *exec_ctx, grpc_connector *con) {
79
79
  }
80
80
 
81
81
  static void on_initial_connect_string_sent(grpc_exec_ctx *exec_ctx, void *arg,
82
- bool success) {
82
+ grpc_error *error) {
83
83
  connector_unref(exec_ctx, arg);
84
84
  }
85
85
 
86
- static void connected(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
86
+ static void connected(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
87
87
  connector *c = arg;
88
88
  grpc_closure *notify;
89
89
  grpc_endpoint *tcp = c->tcp;
@@ -103,13 +103,13 @@ static void connected(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
103
103
  grpc_chttp2_transport_start_reading(exec_ctx, c->result->transport, NULL,
104
104
  0);
105
105
  GPR_ASSERT(c->result->transport);
106
- c->result->channel_args = c->args.channel_args;
106
+ c->result->channel_args = grpc_channel_args_copy(c->args.channel_args);
107
107
  } else {
108
108
  memset(c->result, 0, sizeof(*c->result));
109
109
  }
110
110
  notify = c->notify;
111
111
  c->notify = NULL;
112
- notify->cb(exec_ctx, notify->cb_arg, 1);
112
+ grpc_exec_ctx_sched(exec_ctx, notify, GRPC_ERROR_REF(error), NULL);
113
113
  }
114
114
 
115
115
  static void connector_shutdown(grpc_exec_ctx *exec_ctx, grpc_connector *con) {}
@@ -0,0 +1,95 @@
1
+ /*
2
+ *
3
+ * Copyright 2016, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #include <grpc/grpc.h>
35
+ #include <grpc/grpc_posix.h>
36
+ #include <grpc/support/log.h>
37
+ #include <grpc/support/port_platform.h>
38
+
39
+ #ifdef GPR_SUPPORT_CHANNELS_FROM_FD
40
+
41
+ #include <fcntl.h>
42
+
43
+ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
44
+ #include "src/core/lib/channel/channel_args.h"
45
+ #include "src/core/lib/iomgr/endpoint.h"
46
+ #include "src/core/lib/iomgr/exec_ctx.h"
47
+ #include "src/core/lib/iomgr/tcp_posix.h"
48
+ #include "src/core/lib/surface/api_trace.h"
49
+ #include "src/core/lib/surface/channel.h"
50
+ #include "src/core/lib/transport/transport.h"
51
+
52
+ grpc_channel *grpc_insecure_channel_create_from_fd(
53
+ const char *target, int fd, const grpc_channel_args *args) {
54
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
55
+ GRPC_API_TRACE("grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3,
56
+ (target, fd, args));
57
+
58
+ grpc_arg default_authority_arg;
59
+ default_authority_arg.type = GRPC_ARG_STRING;
60
+ default_authority_arg.key = GRPC_ARG_DEFAULT_AUTHORITY;
61
+ default_authority_arg.value.string = "test.authority";
62
+ grpc_channel_args *final_args =
63
+ grpc_channel_args_copy_and_add(args, &default_authority_arg, 1);
64
+
65
+ int flags = fcntl(fd, F_GETFL, 0);
66
+ GPR_ASSERT(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == 0);
67
+
68
+ grpc_endpoint *client =
69
+ grpc_tcp_create(grpc_fd_create(fd, "client"),
70
+ GRPC_TCP_DEFAULT_READ_SLICE_SIZE, "fd-client");
71
+
72
+ grpc_transport *transport =
73
+ grpc_create_chttp2_transport(&exec_ctx, final_args, client, 1);
74
+ GPR_ASSERT(transport);
75
+ grpc_channel *channel = grpc_channel_create(
76
+ &exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport);
77
+ grpc_channel_args_destroy(final_args);
78
+ grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0);
79
+
80
+ grpc_exec_ctx_finish(&exec_ctx);
81
+
82
+ return channel != NULL ? channel : grpc_lame_client_channel_create(
83
+ target, GRPC_STATUS_INTERNAL,
84
+ "Failed to create client channel");
85
+ }
86
+
87
+ #else // !GPR_SUPPORT_CHANNELS_FROM_FD
88
+
89
+ grpc_channel *grpc_insecure_channel_create_from_fd(
90
+ const char *target, int fd, const grpc_channel_args *args) {
91
+ GPR_ASSERT(0);
92
+ return NULL;
93
+ }
94
+
95
+ #endif // GPR_SUPPORT_CHANNELS_FROM_FD
@@ -45,9 +45,9 @@
45
45
  #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
46
46
  #include "src/core/lib/channel/channel_args.h"
47
47
  #include "src/core/lib/iomgr/tcp_client.h"
48
- #include "src/core/lib/security/auth_filters.h"
49
- #include "src/core/lib/security/credentials.h"
50
- #include "src/core/lib/security/security_context.h"
48
+ #include "src/core/lib/security/context/security_context.h"
49
+ #include "src/core/lib/security/credentials/credentials.h"
50
+ #include "src/core/lib/security/transport/auth_filters.h"
51
51
  #include "src/core/lib/surface/api_trace.h"
52
52
  #include "src/core/lib/surface/channel.h"
53
53
  #include "src/core/lib/tsi/transport_security_interface.h"
@@ -90,7 +90,6 @@ static void on_secure_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
90
90
  grpc_auth_context *auth_context) {
91
91
  connector *c = arg;
92
92
  grpc_closure *notify;
93
- grpc_channel_args *args_copy = NULL;
94
93
  gpr_mu_lock(&c->mu);
95
94
  if (c->connecting_endpoint == NULL) {
96
95
  memset(c->result, 0, sizeof(*c->result));
@@ -109,26 +108,23 @@ static void on_secure_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
109
108
  grpc_chttp2_transport_start_reading(exec_ctx, c->result->transport, NULL,
110
109
  0);
111
110
  auth_context_arg = grpc_auth_context_to_arg(auth_context);
112
- args_copy = grpc_channel_args_copy_and_add(c->args.channel_args,
113
- &auth_context_arg, 1);
114
- c->result->channel_args = args_copy;
111
+ c->result->channel_args = grpc_channel_args_copy_and_add(
112
+ c->args.channel_args, &auth_context_arg, 1);
115
113
  }
116
114
  notify = c->notify;
117
115
  c->notify = NULL;
118
- /* look at c->args which are connector args. */
119
- notify->cb(exec_ctx, notify->cb_arg, 1);
120
- if (args_copy != NULL) grpc_channel_args_destroy(args_copy);
116
+ grpc_exec_ctx_sched(exec_ctx, notify, GRPC_ERROR_NONE, NULL);
121
117
  }
122
118
 
123
119
  static void on_initial_connect_string_sent(grpc_exec_ctx *exec_ctx, void *arg,
124
- bool success) {
120
+ grpc_error *error) {
125
121
  connector *c = arg;
126
- grpc_channel_security_connector_do_handshake(exec_ctx, c->security_connector,
127
- c->connecting_endpoint,
128
- on_secure_handshake_done, c);
122
+ grpc_channel_security_connector_do_handshake(
123
+ exec_ctx, c->security_connector, c->connecting_endpoint, c->args.deadline,
124
+ on_secure_handshake_done, c);
129
125
  }
130
126
 
131
- static void connected(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
127
+ static void connected(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
132
128
  connector *c = arg;
133
129
  grpc_closure *notify;
134
130
  grpc_endpoint *tcp = c->newly_connecting_endpoint;
@@ -147,13 +143,14 @@ static void connected(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
147
143
  &c->initial_string_sent);
148
144
  } else {
149
145
  grpc_channel_security_connector_do_handshake(
150
- exec_ctx, c->security_connector, tcp, on_secure_handshake_done, c);
146
+ exec_ctx, c->security_connector, tcp, c->args.deadline,
147
+ on_secure_handshake_done, c);
151
148
  }
152
149
  } else {
153
150
  memset(c->result, 0, sizeof(*c->result));
154
151
  notify = c->notify;
155
152
  c->notify = NULL;
156
- notify->cb(exec_ctx, notify->cb_arg, 1);
153
+ grpc_exec_ctx_sched(exec_ctx, notify, GRPC_ERROR_REF(error), NULL);
157
154
  }
158
155
  }
159
156
 
@@ -175,7 +172,6 @@ static void connector_connect(grpc_exec_ctx *exec_ctx, grpc_connector *con,
175
172
  grpc_closure *notify) {
176
173
  connector *c = (connector *)con;
177
174
  GPR_ASSERT(c->notify == NULL);
178
- GPR_ASSERT(notify->cb);
179
175
  c->notify = notify;
180
176
  c->args = *args;
181
177
  c->result = result;