diff options
author | Craig Tiller <ctiller@google.com> | 2017-04-27 14:56:56 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-04-27 14:56:56 -0700 |
commit | f7283e01ddefff3d57e30e80a0e1b3530458f400 (patch) | |
tree | 3d5fd7816155142b982d4cfa2a187f05efa1df65 /test/core/util | |
parent | 1939744de5ac47225fa36586dff342b000d08ddc (diff) | |
parent | 4865c79548d4f83ebae4e10fbaf4c3ba10535c97 (diff) |
Merge github.com:grpc/grpc into trickle_stall
Diffstat (limited to 'test/core/util')
-rw-r--r-- | test/core/util/passthru_endpoint.c | 5 | ||||
-rw-r--r-- | test/core/util/trickle_endpoint.c | 8 |
2 files changed, 7 insertions, 6 deletions
diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.c index 121567fc0d..6400845d23 100644 --- a/test/core/util/passthru_endpoint.c +++ b/test/core/util/passthru_endpoint.c @@ -102,13 +102,14 @@ static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Endpoint already shutdown"); } else if (m->on_read != NULL) { for (size_t i = 0; i < slices->count; i++) { - grpc_slice_buffer_add(m->on_read_out, grpc_slice_ref(slices->slices[i])); + grpc_slice_buffer_add(m->on_read_out, grpc_slice_copy(slices->slices[i])); } grpc_closure_sched(exec_ctx, m->on_read, GRPC_ERROR_NONE); m->on_read = NULL; } else { for (size_t i = 0; i < slices->count; i++) { - grpc_slice_buffer_add(&m->read_buffer, grpc_slice_ref(slices->slices[i])); + grpc_slice_buffer_add(&m->read_buffer, + grpc_slice_copy(slices->slices[i])); } } gpr_mu_unlock(&m->parent->mu); diff --git a/test/core/util/trickle_endpoint.c b/test/core/util/trickle_endpoint.c index 02ba257abe..69386a0718 100644 --- a/test/core/util/trickle_endpoint.c +++ b/test/core/util/trickle_endpoint.c @@ -78,15 +78,15 @@ static void maybe_call_write_cb_locked(grpc_exec_ctx *exec_ctx, static void te_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb) { trickle_endpoint *te = (trickle_endpoint *)ep; - for (size_t i = 0; i < slices->count; i++) { - grpc_slice_ref_internal(slices->slices[i]); - } gpr_mu_lock(&te->mu); GPR_ASSERT(te->write_cb == NULL); if (te->write_buffer.length == 0) { te->last_write = gpr_now(GPR_CLOCK_MONOTONIC); } - grpc_slice_buffer_addn(&te->write_buffer, slices->slices, slices->count); + for (size_t i = 0; i < slices->count; i++) { + grpc_slice_buffer_add(&te->write_buffer, + grpc_slice_copy(slices->slices[i])); + } te->write_cb = cb; maybe_call_write_cb_locked(exec_ctx, te); gpr_mu_unlock(&te->mu); |