aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/transport
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-07-06 08:35:02 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-07-06 08:35:02 -0700
commit825b21cd1f999fa55e6234c2d0d8a6375f252c42 (patch)
tree12b05fd918d8600e35e1c5bf78bf25b6d201ae3b /src/core/transport
parenta82fef14b3caa94c133e9c49504243e28ea2cadd (diff)
Fix segfault
The server transport started reading fractionally too early, leading to the accept callback not being ready in some cases.
Diffstat (limited to 'src/core/transport')
-rw-r--r--src/core/transport/chttp2_transport.c20
-rw-r--r--src/core/transport/chttp2_transport.h7
2 files changed, 17 insertions, 10 deletions
diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c
index 0aa28da8f7..054690ac95 100644
--- a/src/core/transport/chttp2_transport.c
+++ b/src/core/transport/chttp2_transport.c
@@ -201,8 +201,8 @@ static void ref_transport(grpc_chttp2_transport *t) { gpr_ref(&t->refs); }
static void init_transport(grpc_chttp2_transport *t,
const grpc_channel_args *channel_args,
- grpc_endpoint *ep, gpr_slice *slices, size_t nslices,
- grpc_mdctx *mdctx, int is_client) {
+ grpc_endpoint *ep, grpc_mdctx *mdctx,
+ int is_client) {
size_t i;
int j;
@@ -311,9 +311,6 @@ static void init_transport(grpc_chttp2_transport *t,
}
}
}
-
- REF_TRANSPORT(t, "recv_data"); /* matches unref inside recv_data */
- recv_data(t, slices, nslices, GRPC_ENDPOINT_CB_OK);
}
static void destroy_transport(grpc_transport *gt) {
@@ -1043,9 +1040,16 @@ static const grpc_transport_vtable vtable = {
perform_transport_op, destroy_stream, destroy_transport};
grpc_transport *grpc_create_chttp2_transport(
- const grpc_channel_args *channel_args, grpc_endpoint *ep, gpr_slice *slices,
- size_t nslices, grpc_mdctx *mdctx, int is_client) {
+ const grpc_channel_args *channel_args, grpc_endpoint *ep, grpc_mdctx *mdctx,
+ int is_client) {
grpc_chttp2_transport *t = gpr_malloc(sizeof(grpc_chttp2_transport));
- init_transport(t, channel_args, ep, slices, nslices, mdctx, is_client);
+ init_transport(t, channel_args, ep, mdctx, is_client);
return &t->base;
}
+
+void grpc_chttp2_transport_start_reading(grpc_transport *transport,
+ gpr_slice *slices, size_t nslices) {
+ grpc_chttp2_transport *t = (grpc_chttp2_transport *)transport;
+ REF_TRANSPORT(t, "recv_data"); /* matches unref inside recv_data */
+ recv_data(t, slices, nslices, GRPC_ENDPOINT_CB_OK);
+}
diff --git a/src/core/transport/chttp2_transport.h b/src/core/transport/chttp2_transport.h
index 1747792b95..fa0d6e4151 100644
--- a/src/core/transport/chttp2_transport.h
+++ b/src/core/transport/chttp2_transport.h
@@ -41,7 +41,10 @@ extern int grpc_http_trace;
extern int grpc_flowctl_trace;
grpc_transport *grpc_create_chttp2_transport(
- const grpc_channel_args *channel_args, grpc_endpoint *ep, gpr_slice *slices,
- size_t nslices, grpc_mdctx *metadata_context, int is_client);
+ const grpc_channel_args *channel_args, grpc_endpoint *ep,
+ grpc_mdctx *metadata_context, int is_client);
+
+void grpc_chttp2_transport_start_reading(grpc_transport *transport,
+ gpr_slice *slices, size_t nslices);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_TRANSPORT_H */