diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/compression/algorithm.c | 2 | ||||
-rw-r--r-- | src/core/compression/algorithm.h | 49 | ||||
-rw-r--r-- | src/core/compression/message_compress.h | 2 | ||||
-rw-r--r-- | src/core/surface/byte_buffer.c | 44 | ||||
-rw-r--r-- | src/core/surface/byte_buffer_reader.c | 81 | ||||
-rw-r--r-- | src/core/surface/call.c | 11 | ||||
-rw-r--r-- | src/core/transport/chttp2_transport.c | 66 | ||||
-rw-r--r-- | src/cpp/proto/proto_utils.cc | 4 | ||||
-rw-r--r-- | src/cpp/util/byte_buffer.cc | 2 | ||||
-rw-r--r-- | src/csharp/ext/grpc_csharp_ext.c | 2 | ||||
-rw-r--r-- | src/node/ext/byte_buffer.cc | 2 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/private/NSData+GRPC.m | 4 | ||||
-rw-r--r-- | src/php/ext/grpc/byte_buffer.c | 2 | ||||
-rw-r--r-- | src/python/src/grpc/_adapter/_c/utility.c | 2 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_byte_buffer.c | 2 |
15 files changed, 110 insertions, 165 deletions
diff --git a/src/core/compression/algorithm.c b/src/core/compression/algorithm.c index ca07002ff9..36ead843d2 100644 --- a/src/core/compression/algorithm.c +++ b/src/core/compression/algorithm.c @@ -31,7 +31,7 @@ * */ -#include "src/core/compression/algorithm.h" +#include <grpc/compression.h> const char *grpc_compression_algorithm_name( grpc_compression_algorithm algorithm) { diff --git a/src/core/compression/algorithm.h b/src/core/compression/algorithm.h deleted file mode 100644 index 9dd9f57b56..0000000000 --- a/src/core/compression/algorithm.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_H -#define GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_H - -/* The various compression algorithms supported by GRPC */ -typedef enum { - GRPC_COMPRESS_NONE = 0, - GRPC_COMPRESS_DEFLATE, - GRPC_COMPRESS_GZIP, - /* TODO(ctiller): snappy */ - GRPC_COMPRESS_ALGORITHMS_COUNT -} grpc_compression_algorithm; - -const char *grpc_compression_algorithm_name( - grpc_compression_algorithm algorithm); - -#endif /* GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_H */ diff --git a/src/core/compression/message_compress.h b/src/core/compression/message_compress.h index e8aef1a713..aba701a6ee 100644 --- a/src/core/compression/message_compress.h +++ b/src/core/compression/message_compress.h @@ -34,7 +34,7 @@ #ifndef GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H #define GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H -#include "src/core/compression/algorithm.h" +#include <grpc/compression.h> #include <grpc/support/slice_buffer.h> /* compress 'input' to 'output' using 'algorithm'. diff --git a/src/core/surface/byte_buffer.c b/src/core/surface/byte_buffer.c index 184c3da26e..4817e00454 100644 --- a/src/core/surface/byte_buffer.c +++ b/src/core/surface/byte_buffer.c @@ -35,35 +35,31 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> -grpc_byte_buffer *grpc_byte_buffer_create(gpr_slice *slices, size_t nslices) { - return grpc_byte_buffer_typed_create(slices, nslices, GRPC_BB_SLICE_BUFFER); +grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices, + size_t nslices) { + return grpc_raw_compressed_byte_buffer_create(slices, nslices, + GRPC_COMPRESS_NONE); } -grpc_byte_buffer *grpc_byte_buffer_typed_create(gpr_slice *slices, - size_t nslices, - grpc_byte_buffer_type type) { +grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create( + gpr_slice *slices, size_t nslices, grpc_compression_algorithm compression) { size_t i; grpc_byte_buffer *bb = malloc(sizeof(grpc_byte_buffer)); - - bb->type = type; - gpr_slice_buffer_init(&bb->data.slice_buffer); + bb->type = GRPC_BB_RAW; + bb->data.raw.compression = compression; + gpr_slice_buffer_init(&bb->data.raw.slice_buffer); for (i = 0; i < nslices; i++) { gpr_slice_ref(slices[i]); - gpr_slice_buffer_add(&bb->data.slice_buffer, slices[i]); + gpr_slice_buffer_add(&bb->data.raw.slice_buffer, slices[i]); } - return bb; } - grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb) { switch (bb->type) { - case GRPC_BB_SLICE_BUFFER: - case GRPC_BB_COMPRESSED_NONE: - case GRPC_BB_COMPRESSED_DEFLATE: - case GRPC_BB_COMPRESSED_GZIP: - return grpc_byte_buffer_create(bb->data.slice_buffer.slices, - bb->data.slice_buffer.count); + case GRPC_BB_RAW: + return grpc_raw_byte_buffer_create(bb->data.raw.slice_buffer.slices, + bb->data.raw.slice_buffer.count); } gpr_log(GPR_INFO, "should never get here"); abort(); @@ -73,11 +69,8 @@ grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb) { void grpc_byte_buffer_destroy(grpc_byte_buffer *bb) { if (!bb) return; switch (bb->type) { - case GRPC_BB_SLICE_BUFFER: - case GRPC_BB_COMPRESSED_NONE: - case GRPC_BB_COMPRESSED_DEFLATE: - case GRPC_BB_COMPRESSED_GZIP: - gpr_slice_buffer_destroy(&bb->data.slice_buffer); + case GRPC_BB_RAW: + gpr_slice_buffer_destroy(&bb->data.raw.slice_buffer); break; } free(bb); @@ -85,11 +78,8 @@ void grpc_byte_buffer_destroy(grpc_byte_buffer *bb) { size_t grpc_byte_buffer_length(grpc_byte_buffer *bb) { switch (bb->type) { - case GRPC_BB_SLICE_BUFFER: - case GRPC_BB_COMPRESSED_NONE: - case GRPC_BB_COMPRESSED_DEFLATE: - case GRPC_BB_COMPRESSED_GZIP: - return bb->data.slice_buffer.length; + case GRPC_BB_RAW: + return bb->data.raw.slice_buffer.length; } gpr_log(GPR_ERROR, "should never reach here"); abort(); diff --git a/src/core/surface/byte_buffer_reader.c b/src/core/surface/byte_buffer_reader.c index 0754a17226..86829a686f 100644 --- a/src/core/surface/byte_buffer_reader.c +++ b/src/core/surface/byte_buffer_reader.c @@ -33,74 +33,73 @@ #include <grpc/byte_buffer_reader.h> +#include <grpc/compression.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/slice_buffer.h> #include <grpc/byte_buffer.h> -#include "src/core/compression/algorithm.h" #include "src/core/compression/message_compress.h" +static int is_compressed(grpc_byte_buffer *buffer) { + switch (buffer->type) { + case GRPC_BB_RAW: + if (buffer->data.raw.compression == GRPC_COMPRESS_NONE) { + return 0 /* GPR_FALSE */; + } + break; + } + return 1 /* GPR_TRUE */; +} + void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader, grpc_byte_buffer *buffer) { - grpc_compression_algorithm compress_algo; gpr_slice_buffer decompressed_slices_buffer; reader->buffer_in = buffer; - switch (buffer->type) { - case GRPC_BB_COMPRESSED_DEFLATE: - case GRPC_BB_COMPRESSED_GZIP: - compress_algo = - GRPC_COMPRESS_ALGORITHM_FROM_BB_TYPE(reader->buffer_in->type); + switch (reader->buffer_in->type) { + case GRPC_BB_RAW: gpr_slice_buffer_init(&decompressed_slices_buffer); - grpc_msg_decompress(compress_algo, &reader->buffer_in->data.slice_buffer, - &decompressed_slices_buffer); - /* the output buffer is a regular GRPC_BB_SLICE_BUFFER */ - reader->buffer_out = grpc_byte_buffer_create( - decompressed_slices_buffer.slices, - decompressed_slices_buffer.count); - gpr_slice_buffer_destroy(&decompressed_slices_buffer); - /* fallthrough */ - case GRPC_BB_SLICE_BUFFER: - case GRPC_BB_COMPRESSED_NONE: + if (is_compressed(reader->buffer_in)) { + grpc_msg_decompress(reader->buffer_in->data.raw.compression, + &reader->buffer_in->data.raw.slice_buffer, + &decompressed_slices_buffer); + reader->buffer_out = grpc_raw_byte_buffer_create( + decompressed_slices_buffer.slices, + decompressed_slices_buffer.count); + gpr_slice_buffer_destroy(&decompressed_slices_buffer); + } else { /* not compressed, use the input buffer as output */ + reader->buffer_out = reader->buffer_in; + } reader->current.index = 0; + break; } } void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) { switch (reader->buffer_in->type) { - case GRPC_BB_COMPRESSED_DEFLATE: - case GRPC_BB_COMPRESSED_GZIP: - grpc_byte_buffer_destroy(reader->buffer_out); + case GRPC_BB_RAW: + /* keeping the same if-else structure as in the init function */ + if (is_compressed(reader->buffer_in)) { + grpc_byte_buffer_destroy(reader->buffer_out); + } break; - case GRPC_BB_SLICE_BUFFER: - case GRPC_BB_COMPRESSED_NONE: - ; /* no-op */ } } int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader, gpr_slice *slice) { - gpr_slice_buffer *slice_buffer; - grpc_byte_buffer *buffer = NULL; - - /* Pick the right buffer based on the input type */ switch (reader->buffer_in->type) { - case GRPC_BB_SLICE_BUFFER: - case GRPC_BB_COMPRESSED_NONE: - buffer = reader->buffer_in; + case GRPC_BB_RAW: { + gpr_slice_buffer *slice_buffer; + slice_buffer = &reader->buffer_out->data.raw.slice_buffer; + if (reader->current.index < slice_buffer->count) { + *slice = gpr_slice_ref(slice_buffer->slices[reader->current.index]); + reader->current.index += 1; + return 1; + } break; - case GRPC_BB_COMPRESSED_DEFLATE: - case GRPC_BB_COMPRESSED_GZIP: - buffer = reader->buffer_out; - break; - } - GPR_ASSERT(buffer); - slice_buffer = &buffer->data.slice_buffer; - if (reader->current.index < slice_buffer->count) { - *slice = gpr_slice_ref(slice_buffer->slices[reader->current.index]); - reader->current.index += 1; - return 1; + } } return 0; } diff --git a/src/core/surface/call.c b/src/core/surface/call.c index ed432393ce..30b15ce37f 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -636,7 +636,7 @@ static void call_on_done_send(void *pc, int success) { static void finish_message(grpc_call *call) { /* TODO(ctiller): this could be a lot faster if coded directly */ - grpc_byte_buffer *byte_buffer = grpc_byte_buffer_create( + grpc_byte_buffer *byte_buffer = grpc_raw_byte_buffer_create( call->incoming_message.slices, call->incoming_message.count); gpr_slice_buffer_reset_and_unref(&call->incoming_message); @@ -806,12 +806,9 @@ static void copy_byte_buffer_to_stream_ops(grpc_byte_buffer *byte_buffer, size_t i; switch (byte_buffer->type) { - case GRPC_BB_SLICE_BUFFER: - case GRPC_BB_COMPRESSED_NONE: - case GRPC_BB_COMPRESSED_DEFLATE: - case GRPC_BB_COMPRESSED_GZIP: - for (i = 0; i < byte_buffer->data.slice_buffer.count; i++) { - gpr_slice slice = byte_buffer->data.slice_buffer.slices[i]; + case GRPC_BB_RAW: + for (i = 0; i < byte_buffer->data.raw.slice_buffer.count; i++) { + gpr_slice slice = byte_buffer->data.raw.slice_buffer.slices[i]; gpr_slice_ref(slice); grpc_sopb_add_slice(sopb, slice); } diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 630504565b..bd259f7ae3 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -230,7 +230,10 @@ struct transport { /* basic state management - what are we doing at the moment? */ gpr_uint8 reading; gpr_uint8 writing; - gpr_uint8 calling_back; + /** are we calling back (via cb) with a channel-level event */ + gpr_uint8 calling_back_channel; + /** are we calling back any grpc_transport_op completion events */ + gpr_uint8 calling_back_ops; gpr_uint8 destroying; gpr_uint8 closed; error_state error_state; @@ -357,7 +360,7 @@ static void push_setting(transport *t, grpc_chttp2_setting_id id, gpr_uint32 value); static int prepare_callbacks(transport *t); -static void run_callbacks(transport *t, const grpc_transport_callbacks *cb); +static void run_callbacks(transport *t); static void call_cb_closed(transport *t, const grpc_transport_callbacks *cb); static int prepare_write(transport *t); @@ -565,7 +568,7 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup, } gpr_mu_lock(&t->mu); - t->calling_back = 1; + t->calling_back_channel = 1; ref_transport(t); /* matches unref at end of this function */ gpr_mu_unlock(&t->mu); @@ -574,7 +577,7 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup, lock(t); t->cb = sr.callbacks; t->cb_user_data = sr.user_data; - t->calling_back = 0; + t->calling_back_channel = 0; if (t->destroying) gpr_cv_signal(&t->cv); unlock(t); @@ -595,7 +598,7 @@ static void destroy_transport(grpc_transport *gt) { We need to be not writing as cancellation finalization may produce some callbacks that NEED to be made to close out some streams when t->writing becomes 0. */ - while (t->calling_back || t->writing) { + while (t->calling_back_channel || t->writing) { gpr_cv_wait(&t->cv, &t->mu, gpr_inf_future); } drop_connection(t); @@ -830,28 +833,29 @@ static void unlock(transport *t) { finish_reads(t); /* gather any callbacks that need to be made */ - if (!t->calling_back) { - t->calling_back = perform_callbacks = prepare_callbacks(t); - if (cb) { - if (t->error_state == ERROR_STATE_SEEN && !t->writing) { - call_closed = 1; - t->calling_back = 1; - t->cb = NULL; /* no more callbacks */ - t->error_state = ERROR_STATE_NOTIFIED; - } - if (t->num_pending_goaways) { - goaways = t->pending_goaways; - num_goaways = t->num_pending_goaways; - t->pending_goaways = NULL; - t->num_pending_goaways = 0; - t->cap_pending_goaways = 0; - t->calling_back = 1; - } - } + if (!t->calling_back_ops) { + t->calling_back_ops = perform_callbacks = prepare_callbacks(t); + if (perform_callbacks) ref_transport(t); } - if (perform_callbacks || call_closed || num_goaways) { - ref_transport(t); + if (!t->calling_back_channel && cb) { + if (t->error_state == ERROR_STATE_SEEN && !t->writing) { + call_closed = 1; + t->calling_back_channel = 1; + t->cb = NULL; /* no more callbacks */ + t->error_state = ERROR_STATE_NOTIFIED; + } + if (t->num_pending_goaways) { + goaways = t->pending_goaways; + num_goaways = t->num_pending_goaways; + t->pending_goaways = NULL; + t->num_pending_goaways = 0; + t->cap_pending_goaways = 0; + t->calling_back_channel = 1; + } + if (call_closed || num_goaways) { + ref_transport(t); + } } /* finally unlock */ @@ -865,7 +869,11 @@ static void unlock(transport *t) { } if (perform_callbacks) { - run_callbacks(t, cb); + run_callbacks(t); + lock(t); + t->calling_back_ops = 0; + unlock(t); + unref_transport(t); } if (call_closed) { @@ -878,9 +886,9 @@ static void unlock(transport *t) { perform_write(t, ep); } - if (perform_callbacks || call_closed || num_goaways) { + if (call_closed || num_goaways) { lock(t); - t->calling_back = 0; + t->calling_back_channel = 0; if (t->destroying) gpr_cv_signal(&t->cv); unlock(t); unref_transport(t); @@ -2101,7 +2109,7 @@ static int prepare_callbacks(transport *t) { return t->executing_callbacks.count > 0; } -static void run_callbacks(transport *t, const grpc_transport_callbacks *cb) { +static void run_callbacks(transport *t) { size_t i; for (i = 0; i < t->executing_callbacks.count; i++) { op_closure c = t->executing_callbacks.callbacks[i]; diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index 7a7e73bba4..f4cf5cf17a 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -49,8 +49,8 @@ class GrpcBufferWriter GRPC_FINAL explicit GrpcBufferWriter(grpc_byte_buffer** bp, int block_size = kMaxBufferLength) : block_size_(block_size), byte_count_(0), have_backup_(false) { - *bp = grpc_byte_buffer_create(NULL, 0); - slice_buffer_ = &(*bp)->data.slice_buffer; + *bp = grpc_raw_byte_buffer_create(NULL, 0); + slice_buffer_ = &(*bp)->data.raw.slice_buffer; } ~GrpcBufferWriter() GRPC_OVERRIDE { diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc index 45eaa2fe5b..a78e4226d2 100644 --- a/src/cpp/util/byte_buffer.cc +++ b/src/cpp/util/byte_buffer.cc @@ -42,7 +42,7 @@ ByteBuffer::ByteBuffer(Slice* slices, size_t nslices) { for (size_t i = 0; i < nslices; i++) { c_slices[i] = slices[i].slice_; } - buffer_ = grpc_byte_buffer_create(c_slices.data(), nslices); + buffer_ = grpc_raw_byte_buffer_create(c_slices.data(), nslices); } void ByteBuffer::Clear() { diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index d59faee7fb..e614fb8e13 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -60,7 +60,7 @@ grpc_byte_buffer *string_to_byte_buffer(const char *buffer, size_t len) { gpr_slice slice = gpr_slice_from_copied_buffer(buffer, len); - grpc_byte_buffer *bb = grpc_byte_buffer_create(&slice, 1); + grpc_byte_buffer *bb = grpc_raw_byte_buffer_create(&slice, 1); gpr_slice_unref(slice); return bb; } diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc index 2c84099069..7eff11c2b3 100644 --- a/src/node/ext/byte_buffer.cc +++ b/src/node/ext/byte_buffer.cc @@ -57,7 +57,7 @@ grpc_byte_buffer *BufferToByteBuffer(Handle<Value> buffer) { char *data = ::node::Buffer::Data(buffer); gpr_slice slice = gpr_slice_malloc(length); memcpy(GPR_SLICE_START_PTR(slice), data, length); - grpc_byte_buffer *byte_buffer(grpc_byte_buffer_create(&slice, 1)); + grpc_byte_buffer *byte_buffer(grpc_raw_byte_buffer_create(&slice, 1)); gpr_slice_unref(slice); return byte_buffer; } diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.m b/src/objective-c/GRPCClient/private/NSData+GRPC.m index 3a7f76887b..e6a6c3c605 100644 --- a/src/objective-c/GRPCClient/private/NSData+GRPC.m +++ b/src/objective-c/GRPCClient/private/NSData+GRPC.m @@ -55,7 +55,7 @@ static void CopyByteBufferToCharArray(grpc_byte_buffer *buffer, char *array) { static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array, size_t length) { gpr_slice slice = gpr_slice_from_copied_buffer(array, length); - grpc_byte_buffer *buffer = grpc_byte_buffer_create(&slice, 1); + grpc_byte_buffer *buffer = grpc_raw_byte_buffer_create(&slice, 1); gpr_slice_unref(slice); return buffer; } @@ -85,7 +85,7 @@ static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array, // The following implementation is thus not optimal, sometimes requiring two // copies (one by self.bytes and another by gpr_slice_from_copied_buffer). // If it turns out to be an issue, we can use enumerateByteRangesUsingblock: - // to create an array of gpr_slice objects to pass to grpc_byte_buffer_create. + // to create an array of gpr_slice objects to pass to grpc_raw_byte_buffer_create. // That would make it do exactly one copy, always. return CopyCharArrayToNewByteBuffer((const char *)self.bytes, (size_t)self.length); } diff --git a/src/php/ext/grpc/byte_buffer.c b/src/php/ext/grpc/byte_buffer.c index bb9d3f5337..8be0a20607 100644 --- a/src/php/ext/grpc/byte_buffer.c +++ b/src/php/ext/grpc/byte_buffer.c @@ -51,7 +51,7 @@ grpc_byte_buffer *string_to_byte_buffer(char *string, size_t length) { gpr_slice slice = gpr_slice_from_copied_buffer(string, length); - grpc_byte_buffer *buffer = grpc_byte_buffer_create(&slice, 1); + grpc_byte_buffer *buffer = grpc_raw_byte_buffer_create(&slice, 1); gpr_slice_unref(slice); return buffer; } diff --git a/src/python/src/grpc/_adapter/_c/utility.c b/src/python/src/grpc/_adapter/_c/utility.c index ced34a6816..6722b53f84 100644 --- a/src/python/src/grpc/_adapter/_c/utility.c +++ b/src/python/src/grpc/_adapter/_c/utility.c @@ -179,7 +179,7 @@ int pygrpc_produce_op(PyObject *op, grpc_op *result) { PyString_AsStringAndSize( PyTuple_GET_ITEM(op, MESSAGE_INDEX), &message, &message_size); message_slice = gpr_slice_from_copied_buffer(message, message_size); - c_op.data.send_message = grpc_byte_buffer_create(&message_slice, 1); + c_op.data.send_message = grpc_raw_byte_buffer_create(&message_slice, 1); gpr_slice_unref(message_slice); break; case GRPC_OP_SEND_CLOSE_FROM_CLIENT: diff --git a/src/ruby/ext/grpc/rb_byte_buffer.c b/src/ruby/ext/grpc/rb_byte_buffer.c index 1cc22f4aff..0aa34c844e 100644 --- a/src/ruby/ext/grpc/rb_byte_buffer.c +++ b/src/ruby/ext/grpc/rb_byte_buffer.c @@ -42,7 +42,7 @@ grpc_byte_buffer* grpc_rb_s_to_byte_buffer(char *string, size_t length) { gpr_slice slice = gpr_slice_from_copied_buffer(string, length); - grpc_byte_buffer *buffer = grpc_byte_buffer_create(&slice, 1); + grpc_byte_buffer *buffer = grpc_raw_byte_buffer_create(&slice, 1); gpr_slice_unref(slice); return buffer; } |