aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/transport/chttp2
diff options
context:
space:
mode:
authorGravatar Yuchen Zeng <zyc@google.com>2016-06-06 16:21:59 -0700
committerGravatar Yuchen Zeng <zyc@google.com>2016-06-06 16:21:59 -0700
commita2bc0ccb500f0fffcdd263420133b4a0d0cbad2d (patch)
treefd9455950f01ac7b7c0db1d33ca53db6779c323e /src/core/ext/transport/chttp2
parent82ec451c427c0275964ee444d11238b07efeb94d (diff)
Get transport from transport global
Avoid introducing cancel_stream_cb_arg
Diffstat (limited to 'src/core/ext/transport/chttp2')
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
index d0c94e6c46..43e9ca1ff5 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
@@ -1529,26 +1529,20 @@ static void close_from_api(grpc_exec_ctx *exec_ctx,
1);
}
-typedef struct {
- grpc_exec_ctx *exec_ctx;
- gpr_slice *optional_drop_message;
-} cancel_stream_cb_arg;
-
static void cancel_stream_cb(grpc_chttp2_transport_global *transport_global,
void *user_data,
grpc_chttp2_stream_global *stream_global) {
- cancel_stream_cb_arg *arg = user_data;
- cancel_from_api(arg->exec_ctx, transport_global, stream_global,
- GRPC_STATUS_UNAVAILABLE, arg->optional_drop_message);
+ grpc_chttp2_transport *transport = TRANSPORT_FROM_GLOBAL(transport_global);
+ cancel_from_api(user_data, transport_global, stream_global,
+ GRPC_STATUS_UNAVAILABLE,
+ GPR_SLICE_IS_EMPTY(transport->optional_drop_message)
+ ? NULL
+ : &transport->optional_drop_message);
}
static void end_all_the_calls(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport *t) {
- cancel_stream_cb_arg arg = {exec_ctx,
- GPR_SLICE_IS_EMPTY(t->optional_drop_message)
- ? NULL
- : &t->optional_drop_message};
- grpc_chttp2_for_all_streams(&t->global, &arg, cancel_stream_cb);
+ grpc_chttp2_for_all_streams(&t->global, exec_ctx, cancel_stream_cb);
}
static void drop_connection(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) {