Skip to content

Commit

Permalink
Make Node extension work with slice changes
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed Dec 13, 2016
1 parent 9e90d22 commit a053f23
Show file tree
Hide file tree
Showing 15 changed files with 235 additions and 123 deletions.
1 change: 1 addition & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@
"src/node/ext/node_grpc.cc",
"src/node/ext/server.cc",
"src/node/ext/server_credentials.cc",
"src/node/ext/slice.cc",
"src/node/ext/timeval.cc",
],
"dependencies": [
Expand Down
2 changes: 2 additions & 0 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3818,6 +3818,7 @@ node_modules:
- src/node/ext/completion_queue_async_worker.h
- src/node/ext/server.h
- src/node/ext/server_credentials.h
- src/node/ext/slice.h
- src/node/ext/timeval.h
js:
- src/node/index.js
Expand All @@ -3839,6 +3840,7 @@ node_modules:
- src/node/ext/node_grpc.cc
- src/node/ext/server.cc
- src/node/ext/server_credentials.cc
- src/node/ext/slice.cc
- src/node/ext/timeval.cc
openssl_fallback:
base_uri: https://openssl.org/source/old/1.0.2/
Expand Down
1 change: 1 addition & 0 deletions grpc.def
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ EXPORTS
grpc_slice_hash
grpc_slice_is_equivalent
grpc_slice_dup
grpc_slice_to_c_string
grpc_slice_buffer_init
grpc_slice_buffer_destroy
grpc_slice_buffer_add
Expand Down
1 change: 1 addition & 0 deletions src/core/lib/iomgr/tcp_uv.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "src/core/lib/iomgr/network_status_tracker.h"
#include "src/core/lib/iomgr/resource_quota.h"
#include "src/core/lib/iomgr/tcp_uv.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"

Expand Down
6 changes: 2 additions & 4 deletions src/node/ext/byte_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "grpc/slice.h"

#include "byte_buffer.h"
#include "slice.h"

namespace grpc {
namespace node {
Expand All @@ -54,10 +55,7 @@ using v8::Value;

grpc_byte_buffer *BufferToByteBuffer(Local<Value> buffer) {
Nan::HandleScope scope;
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_slice slice = CreateSliceFromBuffer(buffer);
grpc_byte_buffer *byte_buffer(grpc_raw_byte_buffer_create(&slice, 1));
grpc_slice_unref(slice);
return byte_buffer;
Expand Down
Loading

0 comments on commit a053f23

Please sign in to comment.