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,48 @@
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
+ #ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H
34
+ #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H
35
+
36
+ #include "src/core/lib/security/credentials/credentials.h"
37
+
38
+ typedef struct {
39
+ grpc_channel_credentials base;
40
+ grpc_ssl_config config;
41
+ } grpc_ssl_credentials;
42
+
43
+ typedef struct {
44
+ grpc_server_credentials base;
45
+ grpc_ssl_server_config config;
46
+ } grpc_ssl_server_credentials;
47
+
48
+ #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H */
@@ -31,12 +31,12 @@
31
31
  *
32
32
  */
33
33
 
34
- #ifndef GRPC_CORE_LIB_SECURITY_AUTH_FILTERS_H
35
- #define GRPC_CORE_LIB_SECURITY_AUTH_FILTERS_H
34
+ #ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H
35
+ #define GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H
36
36
 
37
37
  #include "src/core/lib/channel/channel_stack.h"
38
38
 
39
39
  extern const grpc_channel_filter grpc_client_auth_filter;
40
40
  extern const grpc_channel_filter grpc_server_auth_filter;
41
41
 
42
- #endif /* GRPC_CORE_LIB_SECURITY_AUTH_FILTERS_H */
42
+ #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H */
@@ -31,7 +31,7 @@
31
31
  *
32
32
  */
33
33
 
34
- #include "src/core/lib/security/auth_filters.h"
34
+ #include "src/core/lib/security/transport/auth_filters.h"
35
35
 
36
36
  #include <string.h>
37
37
 
@@ -40,9 +40,9 @@
40
40
  #include <grpc/support/string_util.h>
41
41
 
42
42
  #include "src/core/lib/channel/channel_stack.h"
43
- #include "src/core/lib/security/credentials.h"
44
- #include "src/core/lib/security/security_connector.h"
45
- #include "src/core/lib/security/security_context.h"
43
+ #include "src/core/lib/security/context/security_context.h"
44
+ #include "src/core/lib/security/credentials/credentials.h"
45
+ #include "src/core/lib/security/transport/security_connector.h"
46
46
  #include "src/core/lib/support/string.h"
47
47
  #include "src/core/lib/surface/call.h"
48
48
  #include "src/core/lib/transport/static_metadata.h"
@@ -54,11 +54,11 @@ typedef struct {
54
54
  grpc_call_credentials *creds;
55
55
  grpc_mdstr *host;
56
56
  grpc_mdstr *method;
57
- /* pollset bound to this call; if we need to make external
58
- network requests, they should be done under this pollset
59
- so that work can progress when this call wants work to
60
- progress */
61
- grpc_pollset *pollset;
57
+ /* pollset{_set} bound to this call; if we need to make external
58
+ network requests, they should be done under a pollset added to this
59
+ pollset_set so that work can progress when this call wants work to progress
60
+ */
61
+ grpc_polling_entity *pollent;
62
62
  grpc_transport_stream_op op;
63
63
  uint8_t security_context_set;
64
64
  grpc_linked_mdelem md_links[MAX_CREDENTIALS_METADATA_COUNT];
@@ -184,9 +184,9 @@ static void send_security_metadata(grpc_exec_ctx *exec_ctx,
184
184
  build_auth_metadata_context(&chand->security_connector->base,
185
185
  chand->auth_context, calld);
186
186
  calld->op = *op; /* Copy op (originates from the caller's stack). */
187
- GPR_ASSERT(calld->pollset);
187
+ GPR_ASSERT(calld->pollent != NULL);
188
188
  grpc_call_credentials_get_request_metadata(
189
- exec_ctx, calld->creds, calld->pollset, calld->auth_md_context,
189
+ exec_ctx, calld->creds, calld->pollent, calld->auth_md_context,
190
190
  on_credentials_metadata, elem);
191
191
  }
192
192
 
@@ -270,15 +270,16 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
270
270
  memset(calld, 0, sizeof(*calld));
271
271
  }
272
272
 
273
- static void set_pollset(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
274
- grpc_pollset *pollset) {
273
+ static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
274
+ grpc_call_element *elem,
275
+ grpc_polling_entity *pollent) {
275
276
  call_data *calld = elem->call_data;
276
- calld->pollset = pollset;
277
+ calld->pollent = pollent;
277
278
  }
278
279
 
279
280
  /* Destructor for call_data */
280
281
  static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
281
- void *ignored) {
282
+ const grpc_call_stats *stats, void *ignored) {
282
283
  call_data *calld = elem->call_data;
283
284
  grpc_call_credentials_unref(calld->creds);
284
285
  if (calld->host != NULL) {
@@ -329,8 +330,14 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
329
330
  GRPC_AUTH_CONTEXT_UNREF(chand->auth_context, "client_auth_filter");
330
331
  }
331
332
 
332
- const grpc_channel_filter grpc_client_auth_filter = {
333
- auth_start_transport_op, grpc_channel_next_op, sizeof(call_data),
334
- init_call_elem, set_pollset, destroy_call_elem,
335
- sizeof(channel_data), init_channel_elem, destroy_channel_elem,
336
- grpc_call_next_get_peer, "client-auth"};
333
+ const grpc_channel_filter grpc_client_auth_filter = {auth_start_transport_op,
334
+ grpc_channel_next_op,
335
+ sizeof(call_data),
336
+ init_call_elem,
337
+ set_pollset_or_pollset_set,
338
+ destroy_call_elem,
339
+ sizeof(channel_data),
340
+ init_channel_elem,
341
+ destroy_channel_elem,
342
+ grpc_call_next_get_peer,
343
+ "client-auth"};
@@ -31,7 +31,7 @@
31
31
  *
32
32
  */
33
33
 
34
- #include "src/core/lib/security/handshake.h"
34
+ #include "src/core/lib/security/transport/handshake.h"
35
35
 
36
36
  #include <stdbool.h>
37
37
  #include <string.h>
@@ -39,8 +39,10 @@
39
39
  #include <grpc/support/alloc.h>
40
40
  #include <grpc/support/log.h>
41
41
  #include <grpc/support/slice_buffer.h>
42
- #include "src/core/lib/security/secure_endpoint.h"
43
- #include "src/core/lib/security/security_context.h"
42
+ #include "src/core/lib/iomgr/timer.h"
43
+ #include "src/core/lib/security/context/security_context.h"
44
+ #include "src/core/lib/security/transport/secure_endpoint.h"
45
+ #include "src/core/lib/security/transport/tsi_error.h"
44
46
 
45
47
  #define GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE 256
46
48
 
@@ -60,13 +62,16 @@ typedef struct {
60
62
  grpc_closure on_handshake_data_sent_to_peer;
61
63
  grpc_closure on_handshake_data_received_from_peer;
62
64
  grpc_auth_context *auth_context;
65
+ grpc_timer timer;
66
+ gpr_refcount refs;
63
67
  } grpc_security_handshake;
64
68
 
65
69
  static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
66
- void *setup, bool success);
70
+ void *setup,
71
+ grpc_error *error);
67
72
 
68
73
  static void on_handshake_data_sent_to_peer(grpc_exec_ctx *exec_ctx, void *setup,
69
- bool success);
74
+ grpc_error *error);
70
75
 
71
76
  static void security_connector_remove_handshake(grpc_security_handshake *h) {
72
77
  GPR_ASSERT(!h->is_client_side);
@@ -95,16 +100,34 @@ static void security_connector_remove_handshake(grpc_security_handshake *h) {
95
100
  gpr_mu_unlock(&sc->mu);
96
101
  }
97
102
 
103
+ static void unref_handshake(grpc_security_handshake *h) {
104
+ if (gpr_unref(&h->refs)) {
105
+ if (h->handshaker != NULL) tsi_handshaker_destroy(h->handshaker);
106
+ if (h->handshake_buffer != NULL) gpr_free(h->handshake_buffer);
107
+ gpr_slice_buffer_destroy(&h->left_overs);
108
+ gpr_slice_buffer_destroy(&h->outgoing);
109
+ gpr_slice_buffer_destroy(&h->incoming);
110
+ GRPC_AUTH_CONTEXT_UNREF(h->auth_context, "handshake");
111
+ GRPC_SECURITY_CONNECTOR_UNREF(h->connector, "handshake");
112
+ gpr_free(h);
113
+ }
114
+ }
115
+
98
116
  static void security_handshake_done(grpc_exec_ctx *exec_ctx,
99
117
  grpc_security_handshake *h,
100
- int is_success) {
118
+ grpc_error *error) {
119
+ grpc_timer_cancel(exec_ctx, &h->timer);
101
120
  if (!h->is_client_side) {
102
121
  security_connector_remove_handshake(h);
103
122
  }
104
- if (is_success) {
123
+ if (error == GRPC_ERROR_NONE) {
105
124
  h->cb(exec_ctx, h->user_data, GRPC_SECURITY_OK, h->secure_endpoint,
106
125
  h->auth_context);
107
126
  } else {
127
+ const char *msg = grpc_error_string(error);
128
+ gpr_log(GPR_ERROR, "Security handshake failed: %s", msg);
129
+ grpc_error_free_string(msg);
130
+
108
131
  if (h->secure_endpoint != NULL) {
109
132
  grpc_endpoint_shutdown(exec_ctx, h->secure_endpoint);
110
133
  grpc_endpoint_destroy(exec_ctx, h->secure_endpoint);
@@ -113,14 +136,8 @@ static void security_handshake_done(grpc_exec_ctx *exec_ctx,
113
136
  }
114
137
  h->cb(exec_ctx, h->user_data, GRPC_SECURITY_ERROR, NULL, NULL);
115
138
  }
116
- if (h->handshaker != NULL) tsi_handshaker_destroy(h->handshaker);
117
- if (h->handshake_buffer != NULL) gpr_free(h->handshake_buffer);
118
- gpr_slice_buffer_destroy(&h->left_overs);
119
- gpr_slice_buffer_destroy(&h->outgoing);
120
- gpr_slice_buffer_destroy(&h->incoming);
121
- GRPC_AUTH_CONTEXT_UNREF(h->auth_context, "handshake");
122
- GRPC_SECURITY_CONNECTOR_UNREF(h->connector, "handshake");
123
- gpr_free(h);
139
+ unref_handshake(h);
140
+ GRPC_ERROR_UNREF(error);
124
141
  }
125
142
 
126
143
  static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *user_data,
@@ -130,17 +147,20 @@ static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *user_data,
130
147
  tsi_frame_protector *protector;
131
148
  tsi_result result;
132
149
  if (status != GRPC_SECURITY_OK) {
133
- gpr_log(GPR_ERROR, "Error checking peer.");
134
- security_handshake_done(exec_ctx, h, 0);
150
+ security_handshake_done(
151
+ exec_ctx, h,
152
+ grpc_error_set_int(GRPC_ERROR_CREATE("Error checking peer."),
153
+ GRPC_ERROR_INT_SECURITY_STATUS, status));
135
154
  return;
136
155
  }
137
156
  h->auth_context = GRPC_AUTH_CONTEXT_REF(auth_context, "handshake");
138
157
  result =
139
158
  tsi_handshaker_create_frame_protector(h->handshaker, NULL, &protector);
140
159
  if (result != TSI_OK) {
141
- gpr_log(GPR_ERROR, "Frame protector creation failed with error %s.",
142
- tsi_result_to_string(result));
143
- security_handshake_done(exec_ctx, h, 0);
160
+ security_handshake_done(
161
+ exec_ctx, h,
162
+ grpc_set_tsi_error_result(
163
+ GRPC_ERROR_CREATE("Frame protector creation failed"), result));
144
164
  return;
145
165
  }
146
166
  h->secure_endpoint =
@@ -148,7 +168,7 @@ static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *user_data,
148
168
  h->left_overs.slices, h->left_overs.count);
149
169
  h->left_overs.count = 0;
150
170
  h->left_overs.length = 0;
151
- security_handshake_done(exec_ctx, h, 1);
171
+ security_handshake_done(exec_ctx, h, GRPC_ERROR_NONE);
152
172
  return;
153
173
  }
154
174
 
@@ -157,9 +177,9 @@ static void check_peer(grpc_exec_ctx *exec_ctx, grpc_security_handshake *h) {
157
177
  tsi_result result = tsi_handshaker_extract_peer(h->handshaker, &peer);
158
178
 
159
179
  if (result != TSI_OK) {
160
- gpr_log(GPR_ERROR, "Peer extraction failed with error %s",
161
- tsi_result_to_string(result));
162
- security_handshake_done(exec_ctx, h, 0);
180
+ security_handshake_done(
181
+ exec_ctx, h, grpc_set_tsi_error_result(
182
+ GRPC_ERROR_CREATE("Peer extraction failed"), result));
163
183
  return;
164
184
  }
165
185
  grpc_security_connector_check_peer(exec_ctx, h->connector, peer,
@@ -185,9 +205,9 @@ static void send_handshake_bytes_to_peer(grpc_exec_ctx *exec_ctx,
185
205
  } while (result == TSI_INCOMPLETE_DATA);
186
206
 
187
207
  if (result != TSI_OK) {
188
- gpr_log(GPR_ERROR, "Handshake failed with error %s",
189
- tsi_result_to_string(result));
190
- security_handshake_done(exec_ctx, h, 0);
208
+ security_handshake_done(exec_ctx, h,
209
+ grpc_set_tsi_error_result(
210
+ GRPC_ERROR_CREATE("Handshake failed"), result));
191
211
  return;
192
212
  }
193
213
 
@@ -203,7 +223,7 @@ static void send_handshake_bytes_to_peer(grpc_exec_ctx *exec_ctx,
203
223
 
204
224
  static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
205
225
  void *handshake,
206
- bool success) {
226
+ grpc_error *error) {
207
227
  grpc_security_handshake *h = handshake;
208
228
  size_t consumed_slice_size = 0;
209
229
  tsi_result result = TSI_OK;
@@ -211,9 +231,10 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
211
231
  size_t num_left_overs;
212
232
  int has_left_overs_in_current_slice = 0;
213
233
 
214
- if (!success) {
215
- gpr_log(GPR_ERROR, "Read failed.");
216
- security_handshake_done(exec_ctx, h, 0);
234
+ if (error != GRPC_ERROR_NONE) {
235
+ security_handshake_done(
236
+ exec_ctx, h,
237
+ GRPC_ERROR_CREATE_REFERENCING("Handshake read failed", &error, 1));
217
238
  return;
218
239
  }
219
240
 
@@ -238,9 +259,9 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
238
259
  }
239
260
 
240
261
  if (result != TSI_OK) {
241
- gpr_log(GPR_ERROR, "Handshake failed with error %s",
242
- tsi_result_to_string(result));
243
- security_handshake_done(exec_ctx, h, 0);
262
+ security_handshake_done(exec_ctx, h,
263
+ grpc_set_tsi_error_result(
264
+ GRPC_ERROR_CREATE("Handshake failed"), result));
244
265
  return;
245
266
  }
246
267
 
@@ -270,13 +291,15 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
270
291
 
271
292
  /* If handshake is NULL, the handshake is done. */
272
293
  static void on_handshake_data_sent_to_peer(grpc_exec_ctx *exec_ctx,
273
- void *handshake, bool success) {
294
+ void *handshake, grpc_error *error) {
274
295
  grpc_security_handshake *h = handshake;
275
296
 
276
297
  /* Make sure that write is OK. */
277
- if (!success) {
278
- gpr_log(GPR_ERROR, "Write failed.");
279
- if (handshake != NULL) security_handshake_done(exec_ctx, h, 0);
298
+ if (error != GRPC_ERROR_NONE) {
299
+ if (handshake != NULL)
300
+ security_handshake_done(
301
+ exec_ctx, h,
302
+ GRPC_ERROR_CREATE_REFERENCING("Handshake write failed", &error, 1));
280
303
  return;
281
304
  }
282
305
 
@@ -291,13 +314,19 @@ static void on_handshake_data_sent_to_peer(grpc_exec_ctx *exec_ctx,
291
314
  }
292
315
  }
293
316
 
294
- void grpc_do_security_handshake(grpc_exec_ctx *exec_ctx,
295
- tsi_handshaker *handshaker,
296
- grpc_security_connector *connector,
297
- bool is_client_side,
298
- grpc_endpoint *nonsecure_endpoint,
299
- grpc_security_handshake_done_cb cb,
300
- void *user_data) {
317
+ static void on_timeout(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
318
+ grpc_security_handshake *h = arg;
319
+ if (error == GRPC_ERROR_NONE) {
320
+ grpc_endpoint_shutdown(exec_ctx, h->wrapped_endpoint);
321
+ }
322
+ unref_handshake(h);
323
+ }
324
+
325
+ void grpc_do_security_handshake(
326
+ grpc_exec_ctx *exec_ctx, tsi_handshaker *handshaker,
327
+ grpc_security_connector *connector, bool is_client_side,
328
+ grpc_endpoint *nonsecure_endpoint, gpr_timespec deadline,
329
+ grpc_security_handshake_done_cb cb, void *user_data) {
301
330
  grpc_security_connector_handshake_list *handshake_node;
302
331
  grpc_security_handshake *h = gpr_malloc(sizeof(grpc_security_handshake));
303
332
  memset(h, 0, sizeof(grpc_security_handshake));
@@ -309,6 +338,7 @@ void grpc_do_security_handshake(grpc_exec_ctx *exec_ctx,
309
338
  h->wrapped_endpoint = nonsecure_endpoint;
310
339
  h->user_data = user_data;
311
340
  h->cb = cb;
341
+ gpr_ref_init(&h->refs, 2); /* timer and handshake proper each get a ref */
312
342
  grpc_closure_init(&h->on_handshake_data_sent_to_peer,
313
343
  on_handshake_data_sent_to_peer, h);
314
344
  grpc_closure_init(&h->on_handshake_data_received_from_peer,
@@ -327,6 +357,8 @@ void grpc_do_security_handshake(grpc_exec_ctx *exec_ctx,
327
357
  gpr_mu_unlock(&server_connector->mu);
328
358
  }
329
359
  send_handshake_bytes_to_peer(exec_ctx, h);
360
+ grpc_timer_init(exec_ctx, &h->timer, deadline, on_timeout, h,
361
+ gpr_now(deadline.clock_type));
330
362
  }
331
363
 
332
364
  void grpc_security_handshake_shutdown(grpc_exec_ctx *exec_ctx,
@@ -31,21 +31,19 @@
31
31
  *
32
32
  */
33
33
 
34
- #ifndef GRPC_CORE_LIB_SECURITY_HANDSHAKE_H
35
- #define GRPC_CORE_LIB_SECURITY_HANDSHAKE_H
34
+ #ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_HANDSHAKE_H
35
+ #define GRPC_CORE_LIB_SECURITY_TRANSPORT_HANDSHAKE_H
36
36
 
37
37
  #include "src/core/lib/iomgr/endpoint.h"
38
- #include "src/core/lib/security/security_connector.h"
38
+ #include "src/core/lib/security/transport/security_connector.h"
39
39
 
40
40
  /* Calls the callback upon completion. Takes owership of handshaker. */
41
- void grpc_do_security_handshake(grpc_exec_ctx *exec_ctx,
42
- tsi_handshaker *handshaker,
43
- grpc_security_connector *connector,
44
- bool is_client_side,
45
- grpc_endpoint *nonsecure_endpoint,
46
- grpc_security_handshake_done_cb cb,
47
- void *user_data);
41
+ void grpc_do_security_handshake(
42
+ grpc_exec_ctx *exec_ctx, tsi_handshaker *handshaker,
43
+ grpc_security_connector *connector, bool is_client_side,
44
+ grpc_endpoint *nonsecure_endpoint, gpr_timespec deadline,
45
+ grpc_security_handshake_done_cb cb, void *user_data);
48
46
 
49
47
  void grpc_security_handshake_shutdown(grpc_exec_ctx *exec_ctx, void *handshake);
50
48
 
51
- #endif /* GRPC_CORE_LIB_SECURITY_HANDSHAKE_H */
49
+ #endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_HANDSHAKE_H */
@@ -31,13 +31,14 @@
31
31
  *
32
32
  */
33
33
 
34
- #include "src/core/lib/security/secure_endpoint.h"
34
+ #include "src/core/lib/security/transport/secure_endpoint.h"
35
35
  #include <grpc/support/alloc.h>
36
36
  #include <grpc/support/log.h>
37
37
  #include <grpc/support/slice.h>
38
38
  #include <grpc/support/slice_buffer.h>
39
39
  #include <grpc/support/sync.h>
40
40
  #include "src/core/lib/debug/trace.h"
41
+ #include "src/core/lib/security/transport/tsi_error.h"
41
42
  #include "src/core/lib/support/string.h"
42
43
  #include "src/core/lib/tsi/transport_security_interface.h"
43
44
 
@@ -126,8 +127,8 @@ static void flush_read_staging_buffer(secure_endpoint *ep, uint8_t **cur,
126
127
  }
127
128
 
128
129
  static void call_read_cb(grpc_exec_ctx *exec_ctx, secure_endpoint *ep,
129
- bool success) {
130
- if (grpc_trace_secure_endpoint) {
130
+ grpc_error *error) {
131
+ if (false && grpc_trace_secure_endpoint) {
131
132
  size_t i;
132
133
  for (i = 0; i < ep->read_buffer->count; i++) {
133
134
  char *data = gpr_dump_slice(ep->read_buffer->slices[i],
@@ -137,11 +138,12 @@ static void call_read_cb(grpc_exec_ctx *exec_ctx, secure_endpoint *ep,
137
138
  }
138
139
  }
139
140
  ep->read_buffer = NULL;
140
- grpc_exec_ctx_enqueue(exec_ctx, ep->read_cb, success, NULL);
141
+ grpc_exec_ctx_sched(exec_ctx, ep->read_cb, error, NULL);
141
142
  SECURE_ENDPOINT_UNREF(exec_ctx, ep, "read");
142
143
  }
143
144
 
144
- static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
145
+ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data,
146
+ grpc_error *error) {
145
147
  unsigned i;
146
148
  uint8_t keep_looping = 0;
147
149
  tsi_result result = TSI_OK;
@@ -149,9 +151,10 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
149
151
  uint8_t *cur = GPR_SLICE_START_PTR(ep->read_staging_buffer);
150
152
  uint8_t *end = GPR_SLICE_END_PTR(ep->read_staging_buffer);
151
153
 
152
- if (!success) {
154
+ if (error != GRPC_ERROR_NONE) {
153
155
  gpr_slice_buffer_reset_and_unref(ep->read_buffer);
154
- call_read_cb(exec_ctx, ep, 0);
156
+ call_read_cb(exec_ctx, ep, GRPC_ERROR_CREATE_REFERENCING(
157
+ "Secure read failed", &error, 1));
155
158
  return;
156
159
  }
157
160
 
@@ -208,11 +211,12 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
208
211
 
209
212
  if (result != TSI_OK) {
210
213
  gpr_slice_buffer_reset_and_unref(ep->read_buffer);
211
- call_read_cb(exec_ctx, ep, 0);
214
+ call_read_cb(exec_ctx, ep, grpc_set_tsi_error_result(
215
+ GRPC_ERROR_CREATE("Unwrap failed"), result));
212
216
  return;
213
217
  }
214
218
 
215
- call_read_cb(exec_ctx, ep, 1);
219
+ call_read_cb(exec_ctx, ep, GRPC_ERROR_NONE);
216
220
  }
217
221
 
218
222
  static void endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
@@ -226,7 +230,7 @@ static void endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
226
230
  if (ep->leftover_bytes.count) {
227
231
  gpr_slice_buffer_swap(&ep->leftover_bytes, &ep->source_buffer);
228
232
  GPR_ASSERT(ep->leftover_bytes.count == 0);
229
- on_read(exec_ctx, ep, 1);
233
+ on_read(exec_ctx, ep, GRPC_ERROR_NONE);
230
234
  return;
231
235
  }
232
236
 
@@ -252,7 +256,7 @@ static void endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
252
256
 
253
257
  gpr_slice_buffer_reset_and_unref(&ep->output_buffer);
254
258
 
255
- if (grpc_trace_secure_endpoint) {
259
+ if (false && grpc_trace_secure_endpoint) {
256
260
  for (i = 0; i < slices->count; i++) {
257
261
  char *data =
258
262
  gpr_dump_slice(slices->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
@@ -315,7 +319,10 @@ static void endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
315
319
  if (result != TSI_OK) {
316
320
  /* TODO(yangg) do different things according to the error type? */
317
321
  gpr_slice_buffer_reset_and_unref(&ep->output_buffer);
318
- grpc_exec_ctx_enqueue(exec_ctx, cb, false, NULL);
322
+ grpc_exec_ctx_sched(
323
+ exec_ctx, cb,
324
+ grpc_set_tsi_error_result(GRPC_ERROR_CREATE("Wrap failed"), result),
325
+ NULL);
319
326
  return;
320
327
  }
321
328