aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/ext/byte_buffer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/node/ext/byte_buffer.cc')
-rw-r--r--src/node/ext/byte_buffer.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc
index 7d6fb19860..fc339fc462 100644
--- a/src/node/ext/byte_buffer.cc
+++ b/src/node/ext/byte_buffer.cc
@@ -40,7 +40,6 @@
#include "grpc/slice.h"
#include "byte_buffer.h"
-#include "slice.h"
namespace grpc {
namespace node {
@@ -55,7 +54,10 @@ using v8::Value;
grpc_byte_buffer *BufferToByteBuffer(Local<Value> buffer) {
Nan::HandleScope scope;
- grpc_slice slice = CreateSliceFromBuffer(buffer);
+ int length = ::node::Buffer::Length(buffer);
+ char *data = ::node::Buffer::Data(buffer);
+ grpc_slice slice = grpc_slice_malloc(length);
+ memcpy(GRPC_SLICE_START_PTR(slice), data, length);
grpc_byte_buffer *byte_buffer(grpc_raw_byte_buffer_create(&slice, 1));
grpc_slice_unref(slice);
return byte_buffer;