aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2018-02-13 14:15:31 -0800
committerGravatar Mark D. Roth <roth@google.com>2018-02-13 14:32:42 -0800
commitef58813f0ad62dc3870e5261d475752c294ab2d5 (patch)
tree02d1ed8f117a53a10e41d5c0aa51bf76d2e1296c
parentb096853b51209dd0718816c1310a0c026ab4bfab (diff)
Fix inproc transport to destroy the send_message byte stream.
-rw-r--r--src/core/ext/transport/inproc/inproc_transport.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc
index 2022eaffe5..04f6580096 100644
--- a/src/core/ext/transport/inproc/inproc_transport.cc
+++ b/src/core/ext/transport/inproc/inproc_transport.cc
@@ -506,6 +506,14 @@ static void fail_helper_locked(inproc_stream* s, grpc_error* error) {
GRPC_ERROR_UNREF(error);
}
+// TODO(vpai): It should not be necessary to drain the incoming byte
+// stream and create a new one; instead, we should simply pass the byte
+// stream from the sender directly to the receiver as-is.
+//
+// Note that fixing this will also avoid the assumption in this code
+// that the incoming byte stream's next() call will always return
+// synchronously. That assumption is true today but may not always be
+// true in the future.
static void message_transfer_locked(inproc_stream* sender,
inproc_stream* receiver) {
size_t remaining =
@@ -532,6 +540,8 @@ static void message_transfer_locked(inproc_stream* sender,
remaining -= GRPC_SLICE_LENGTH(message_slice);
grpc_slice_buffer_add(&receiver->recv_message, message_slice);
} while (remaining > 0);
+ grpc_byte_stream_destroy(
+ sender->send_message_op->payload->send_message.send_message);
grpc_slice_buffer_stream_init(&receiver->recv_stream, &receiver->recv_message,
0);