The library now compiles with Node 0.11+ and all versions of io.js

pull/952/head
murgatroid99 10 years ago
parent 5f875d2986
commit f28066b930
  1. 8
      src/node/ext/call.cc
  2. 8
      src/node/ext/call.h
  3. 14
      src/node/ext/channel.cc
  4. 2
      src/node/ext/channel.h
  5. 56
      src/node/ext/credentials.cc
  6. 2
      src/node/ext/credentials.h
  7. 6
      src/node/ext/node_grpc.cc
  8. 27
      src/node/ext/server.cc
  9. 2
      src/node/ext/server.h
  10. 40
      src/node/ext/server_credentials.cc
  11. 2
      src/node/ext/server_credentials.h

@ -102,8 +102,8 @@ bool CreateMetadataArray(Handle<Object> metadata, grpc_metadata_array *array,
if (::node::Buffer::HasInstance(value)) { if (::node::Buffer::HasInstance(value)) {
current->value = ::node::Buffer::Data(value); current->value = ::node::Buffer::Data(value);
current->value_length = ::node::Buffer::Length(value); current->value_length = ::node::Buffer::Length(value);
Persistent<Value> handle; Persistent<Value> *handle = new Persistent<Value>();
NanAssignPersistent(handle, value); NanAssignPersistent(*handle, value);
resources->handles.push_back(unique_ptr<PersistentHolder>( resources->handles.push_back(unique_ptr<PersistentHolder>(
new PersistentHolder(handle))); new PersistentHolder(handle)));
} else if (value->IsString()) { } else if (value->IsString()) {
@ -196,8 +196,8 @@ class SendMessageOp : public Op {
return false; return false;
} }
out->data.send_message = BufferToByteBuffer(value); out->data.send_message = BufferToByteBuffer(value);
Persistent<Value> handle; Persistent<Value> *handle = new Persistent<Value>();
NanAssignPersistent(handle, value); NanAssignPersistent(*handle, value);
resources->handles.push_back(unique_ptr<PersistentHolder>( resources->handles.push_back(unique_ptr<PersistentHolder>(
new PersistentHolder(handle))); new PersistentHolder(handle)));
return true; return true;

@ -40,6 +40,7 @@
#include <node.h> #include <node.h>
#include <nan.h> #include <nan.h>
#include "grpc/grpc.h" #include "grpc/grpc.h"
#include "grpc/support/log.h"
#include "channel.h" #include "channel.h"
@ -54,16 +55,17 @@ v8::Handle<v8::Value> ParseMetadata(const grpc_metadata_array *metadata_array);
class PersistentHolder { class PersistentHolder {
public: public:
explicit PersistentHolder(v8::Persistent<v8::Value> persist) : explicit PersistentHolder(v8::Persistent<v8::Value> *persist) :
persist(persist) { persist(persist) {
} }
~PersistentHolder() { ~PersistentHolder() {
NanDisposePersistent(persist); NanDisposePersistent(*persist);
delete persist;
} }
private: private:
v8::Persistent<v8::Value> persist; v8::Persistent<v8::Value> *persist;
}; };
struct Resources { struct Resources {

@ -45,7 +45,6 @@
namespace grpc { namespace grpc {
namespace node { namespace node {
using v8::Arguments;
using v8::Array; using v8::Array;
using v8::Exception; using v8::Exception;
using v8::Function; using v8::Function;
@ -59,7 +58,7 @@ using v8::Persistent;
using v8::String; using v8::String;
using v8::Value; using v8::Value;
Persistent<Function> Channel::constructor; NanCallback *Channel::constructor;
Persistent<FunctionTemplate> Channel::fun_tpl; Persistent<FunctionTemplate> Channel::fun_tpl;
Channel::Channel(grpc_channel *channel, NanUtf8String *host) Channel::Channel(grpc_channel *channel, NanUtf8String *host)
@ -74,14 +73,15 @@ Channel::~Channel() {
void Channel::Init(Handle<Object> exports) { void Channel::Init(Handle<Object> exports) {
NanScope(); NanScope();
Local<FunctionTemplate> tpl = FunctionTemplate::New(New); Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
tpl->SetClassName(NanNew("Channel")); tpl->SetClassName(NanNew("Channel"));
tpl->InstanceTemplate()->SetInternalFieldCount(1); tpl->InstanceTemplate()->SetInternalFieldCount(1);
NanSetPrototypeTemplate(tpl, "close", NanSetPrototypeTemplate(tpl, "close",
FunctionTemplate::New(Close)->GetFunction()); NanNew<FunctionTemplate>(Close)->GetFunction());
NanAssignPersistent(fun_tpl, tpl); NanAssignPersistent(fun_tpl, tpl);
NanAssignPersistent(constructor, tpl->GetFunction()); Handle<Function> ctr = tpl->GetFunction();
exports->Set(NanNew("Channel"), constructor); constructor = new NanCallback(ctr);
exports->Set(NanNew("Channel"), ctr);
} }
bool Channel::HasInstance(Handle<Value> val) { bool Channel::HasInstance(Handle<Value> val) {
@ -170,7 +170,7 @@ NAN_METHOD(Channel::New) {
} else { } else {
const int argc = 2; const int argc = 2;
Local<Value> argv[argc] = {args[0], args[1]}; Local<Value> argv[argc] = {args[0], args[1]};
NanReturnValue(constructor->NewInstance(argc, argv)); NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv));
} }
} }

@ -66,7 +66,7 @@ class Channel : public ::node::ObjectWrap {
static NAN_METHOD(New); static NAN_METHOD(New);
static NAN_METHOD(Close); static NAN_METHOD(Close);
static v8::Persistent<v8::Function> constructor; static NanCallback *constructor;
static v8::Persistent<v8::FunctionTemplate> fun_tpl; static v8::Persistent<v8::FunctionTemplate> fun_tpl;
grpc_channel *wrapped_channel; grpc_channel *wrapped_channel;

@ -41,8 +41,6 @@
namespace grpc { namespace grpc {
namespace node { namespace node {
using ::node::Buffer;
using v8::Arguments;
using v8::Exception; using v8::Exception;
using v8::External; using v8::External;
using v8::Function; using v8::Function;
@ -56,7 +54,7 @@ using v8::ObjectTemplate;
using v8::Persistent; using v8::Persistent;
using v8::Value; using v8::Value;
Persistent<Function> Credentials::constructor; NanCallback *Credentials::constructor;
Persistent<FunctionTemplate> Credentials::fun_tpl; Persistent<FunctionTemplate> Credentials::fun_tpl;
Credentials::Credentials(grpc_credentials *credentials) Credentials::Credentials(grpc_credentials *credentials)
@ -68,24 +66,25 @@ Credentials::~Credentials() {
void Credentials::Init(Handle<Object> exports) { void Credentials::Init(Handle<Object> exports) {
NanScope(); NanScope();
Local<FunctionTemplate> tpl = FunctionTemplate::New(New); Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
tpl->SetClassName(NanNew("Credentials")); tpl->SetClassName(NanNew("Credentials"));
tpl->InstanceTemplate()->SetInternalFieldCount(1); tpl->InstanceTemplate()->SetInternalFieldCount(1);
NanAssignPersistent(fun_tpl, tpl); NanAssignPersistent(fun_tpl, tpl);
NanAssignPersistent(constructor, tpl->GetFunction()); Handle<Function> ctr = tpl->GetFunction();
constructor->Set(NanNew("createDefault"), ctr->Set(NanNew("createDefault"),
FunctionTemplate::New(CreateDefault)->GetFunction()); NanNew<FunctionTemplate>(CreateDefault)->GetFunction());
constructor->Set(NanNew("createSsl"), ctr->Set(NanNew("createSsl"),
FunctionTemplate::New(CreateSsl)->GetFunction()); NanNew<FunctionTemplate>(CreateSsl)->GetFunction());
constructor->Set(NanNew("createComposite"), ctr->Set(NanNew("createComposite"),
FunctionTemplate::New(CreateComposite)->GetFunction()); NanNew<FunctionTemplate>(CreateComposite)->GetFunction());
constructor->Set(NanNew("createGce"), ctr->Set(NanNew("createGce"),
FunctionTemplate::New(CreateGce)->GetFunction()); NanNew<FunctionTemplate>(CreateGce)->GetFunction());
constructor->Set(NanNew("createFake"), ctr->Set(NanNew("createFake"),
FunctionTemplate::New(CreateFake)->GetFunction()); NanNew<FunctionTemplate>(CreateFake)->GetFunction());
constructor->Set(NanNew("createIam"), ctr->Set(NanNew("createIam"),
FunctionTemplate::New(CreateIam)->GetFunction()); NanNew<FunctionTemplate>(CreateIam)->GetFunction());
exports->Set(NanNew("Credentials"), constructor); constructor = new NanCallback(ctr);
exports->Set(NanNew("Credentials"), ctr);
} }
bool Credentials::HasInstance(Handle<Value> val) { bool Credentials::HasInstance(Handle<Value> val) {
@ -100,8 +99,8 @@ Handle<Value> Credentials::WrapStruct(grpc_credentials *credentials) {
} }
const int argc = 1; const int argc = 1;
Handle<Value> argv[argc] = { Handle<Value> argv[argc] = {
External::New(reinterpret_cast<void *>(credentials))}; NanNew<External>(reinterpret_cast<void *>(credentials))};
return NanEscapeScope(constructor->NewInstance(argc, argv)); return NanEscapeScope(constructor->GetFunction()->NewInstance(argc, argv));
} }
grpc_credentials *Credentials::GetWrappedCredentials() { grpc_credentials *Credentials::GetWrappedCredentials() {
@ -116,15 +115,16 @@ NAN_METHOD(Credentials::New) {
return NanThrowTypeError( return NanThrowTypeError(
"Credentials can only be created with the provided functions"); "Credentials can only be created with the provided functions");
} }
Handle<External> ext = args[0].As<External>();
grpc_credentials *creds_value = grpc_credentials *creds_value =
reinterpret_cast<grpc_credentials *>(External::Unwrap(args[0])); reinterpret_cast<grpc_credentials *>(ext->Value());
Credentials *credentials = new Credentials(creds_value); Credentials *credentials = new Credentials(creds_value);
credentials->Wrap(args.This()); credentials->Wrap(args.This());
NanReturnValue(args.This()); NanReturnValue(args.This());
} else { } else {
const int argc = 1; const int argc = 1;
Local<Value> argv[argc] = {args[0]}; Local<Value> argv[argc] = {args[0]};
NanReturnValue(constructor->NewInstance(argc, argv)); NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv));
} }
} }
@ -137,19 +137,19 @@ NAN_METHOD(Credentials::CreateSsl) {
NanScope(); NanScope();
char *root_certs = NULL; char *root_certs = NULL;
grpc_ssl_pem_key_cert_pair key_cert_pair = {NULL, NULL}; grpc_ssl_pem_key_cert_pair key_cert_pair = {NULL, NULL};
if (Buffer::HasInstance(args[0])) { if (::node::Buffer::HasInstance(args[0])) {
root_certs = Buffer::Data(args[0]); root_certs = ::node::Buffer::Data(args[0]);
} else if (!(args[0]->IsNull() || args[0]->IsUndefined())) { } else if (!(args[0]->IsNull() || args[0]->IsUndefined())) {
return NanThrowTypeError("createSsl's first argument must be a Buffer"); return NanThrowTypeError("createSsl's first argument must be a Buffer");
} }
if (Buffer::HasInstance(args[1])) { if (::node::Buffer::HasInstance(args[1])) {
key_cert_pair.private_key = Buffer::Data(args[1]); key_cert_pair.private_key = ::node::Buffer::Data(args[1]);
} else if (!(args[1]->IsNull() || args[1]->IsUndefined())) { } else if (!(args[1]->IsNull() || args[1]->IsUndefined())) {
return NanThrowTypeError( return NanThrowTypeError(
"createSSl's second argument must be a Buffer if provided"); "createSSl's second argument must be a Buffer if provided");
} }
if (Buffer::HasInstance(args[2])) { if (::node::Buffer::HasInstance(args[2])) {
key_cert_pair.cert_chain = Buffer::Data(args[2]); key_cert_pair.cert_chain = ::node::Buffer::Data(args[2]);
} else if (!(args[2]->IsNull() || args[2]->IsUndefined())) { } else if (!(args[2]->IsNull() || args[2]->IsUndefined())) {
return NanThrowTypeError( return NanThrowTypeError(
"createSSl's third argument must be a Buffer if provided"); "createSSl's third argument must be a Buffer if provided");

@ -68,7 +68,7 @@ class Credentials : public ::node::ObjectWrap {
static NAN_METHOD(CreateGce); static NAN_METHOD(CreateGce);
static NAN_METHOD(CreateFake); static NAN_METHOD(CreateFake);
static NAN_METHOD(CreateIam); static NAN_METHOD(CreateIam);
static v8::Persistent<v8::Function> constructor; static NanCallback *constructor;
// Used for typechecking instances of this javascript class // Used for typechecking instances of this javascript class
static v8::Persistent<v8::FunctionTemplate> fun_tpl; static v8::Persistent<v8::FunctionTemplate> fun_tpl;

@ -51,7 +51,7 @@ using v8::String;
void InitStatusConstants(Handle<Object> exports) { void InitStatusConstants(Handle<Object> exports) {
NanScope(); NanScope();
Handle<Object> status = Object::New(); Handle<Object> status = NanNew<Object>();
exports->Set(NanNew("status"), status); exports->Set(NanNew("status"), status);
Handle<Value> OK(NanNew<Uint32, uint32_t>(GRPC_STATUS_OK)); Handle<Value> OK(NanNew<Uint32, uint32_t>(GRPC_STATUS_OK));
status->Set(NanNew("OK"), OK); status->Set(NanNew("OK"), OK);
@ -100,7 +100,7 @@ void InitStatusConstants(Handle<Object> exports) {
void InitCallErrorConstants(Handle<Object> exports) { void InitCallErrorConstants(Handle<Object> exports) {
NanScope(); NanScope();
Handle<Object> call_error = Object::New(); Handle<Object> call_error = NanNew<Object>();
exports->Set(NanNew("callError"), call_error); exports->Set(NanNew("callError"), call_error);
Handle<Value> OK(NanNew<Uint32, uint32_t>(GRPC_CALL_OK)); Handle<Value> OK(NanNew<Uint32, uint32_t>(GRPC_CALL_OK));
call_error->Set(NanNew("OK"), OK); call_error->Set(NanNew("OK"), OK);
@ -131,7 +131,7 @@ void InitCallErrorConstants(Handle<Object> exports) {
void InitOpTypeConstants(Handle<Object> exports) { void InitOpTypeConstants(Handle<Object> exports) {
NanScope(); NanScope();
Handle<Object> op_type = Object::New(); Handle<Object> op_type = NanNew<Object>();
exports->Set(NanNew("opType"), op_type); exports->Set(NanNew("opType"), op_type);
Handle<Value> SEND_INITIAL_METADATA( Handle<Value> SEND_INITIAL_METADATA(
NanNew<Uint32, uint32_t>(GRPC_OP_SEND_INITIAL_METADATA)); NanNew<Uint32, uint32_t>(GRPC_OP_SEND_INITIAL_METADATA));

@ -53,7 +53,6 @@ namespace grpc {
namespace node { namespace node {
using std::unique_ptr; using std::unique_ptr;
using v8::Arguments;
using v8::Array; using v8::Array;
using v8::Boolean; using v8::Boolean;
using v8::Date; using v8::Date;
@ -69,7 +68,7 @@ using v8::Persistent;
using v8::String; using v8::String;
using v8::Value; using v8::Value;
Persistent<Function> Server::constructor; NanCallback *Server::constructor;
Persistent<FunctionTemplate> Server::fun_tpl; Persistent<FunctionTemplate> Server::fun_tpl;
class NewCallOp : public Op { class NewCallOp : public Op {
@ -121,28 +120,30 @@ Server::~Server() { grpc_server_destroy(wrapped_server); }
void Server::Init(Handle<Object> exports) { void Server::Init(Handle<Object> exports) {
NanScope(); NanScope();
Local<FunctionTemplate> tpl = FunctionTemplate::New(New); Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
tpl->SetClassName(String::NewSymbol("Server")); tpl->SetClassName(NanNew("Server"));
tpl->InstanceTemplate()->SetInternalFieldCount(1); tpl->InstanceTemplate()->SetInternalFieldCount(1);
NanSetPrototypeTemplate(tpl, "requestCall", NanSetPrototypeTemplate(tpl, "requestCall",
FunctionTemplate::New(RequestCall)->GetFunction()); NanNew<FunctionTemplate>(RequestCall)->GetFunction());
NanSetPrototypeTemplate(tpl, "addHttp2Port", NanSetPrototypeTemplate(
FunctionTemplate::New(AddHttp2Port)->GetFunction()); tpl, "addHttp2Port",
NanNew<FunctionTemplate>(AddHttp2Port)->GetFunction());
NanSetPrototypeTemplate( NanSetPrototypeTemplate(
tpl, "addSecureHttp2Port", tpl, "addSecureHttp2Port",
FunctionTemplate::New(AddSecureHttp2Port)->GetFunction()); NanNew<FunctionTemplate>(AddSecureHttp2Port)->GetFunction());
NanSetPrototypeTemplate(tpl, "start", NanSetPrototypeTemplate(tpl, "start",
FunctionTemplate::New(Start)->GetFunction()); NanNew<FunctionTemplate>(Start)->GetFunction());
NanSetPrototypeTemplate(tpl, "shutdown", NanSetPrototypeTemplate(tpl, "shutdown",
FunctionTemplate::New(Shutdown)->GetFunction()); NanNew<FunctionTemplate>(Shutdown)->GetFunction());
NanAssignPersistent(fun_tpl, tpl); NanAssignPersistent(fun_tpl, tpl);
NanAssignPersistent(constructor, tpl->GetFunction()); Handle<Function> ctr = tpl->GetFunction();
exports->Set(String::NewSymbol("Server"), constructor); constructor = new NanCallback(ctr);
exports->Set(NanNew("Server"), ctr);
} }
bool Server::HasInstance(Handle<Value> val) { bool Server::HasInstance(Handle<Value> val) {
@ -157,7 +158,7 @@ NAN_METHOD(Server::New) {
if (!args.IsConstructCall()) { if (!args.IsConstructCall()) {
const int argc = 1; const int argc = 1;
Local<Value> argv[argc] = {args[0]}; Local<Value> argv[argc] = {args[0]};
NanReturnValue(constructor->NewInstance(argc, argv)); NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv));
} }
grpc_server *wrapped_server; grpc_server *wrapped_server;
grpc_completion_queue *queue = CompletionQueueAsyncWorker::GetQueue(); grpc_completion_queue *queue = CompletionQueueAsyncWorker::GetQueue();

@ -67,7 +67,7 @@ class Server : public ::node::ObjectWrap {
static NAN_METHOD(AddSecureHttp2Port); static NAN_METHOD(AddSecureHttp2Port);
static NAN_METHOD(Start); static NAN_METHOD(Start);
static NAN_METHOD(Shutdown); static NAN_METHOD(Shutdown);
static v8::Persistent<v8::Function> constructor; static NanCallback *constructor;
static v8::Persistent<v8::FunctionTemplate> fun_tpl; static v8::Persistent<v8::FunctionTemplate> fun_tpl;
grpc_server *wrapped_server; grpc_server *wrapped_server;

@ -41,8 +41,6 @@
namespace grpc { namespace grpc {
namespace node { namespace node {
using ::node::Buffer;
using v8::Arguments;
using v8::Exception; using v8::Exception;
using v8::External; using v8::External;
using v8::Function; using v8::Function;
@ -56,7 +54,7 @@ using v8::ObjectTemplate;
using v8::Persistent; using v8::Persistent;
using v8::Value; using v8::Value;
Persistent<Function> ServerCredentials::constructor; NanCallback *ServerCredentials::constructor;
Persistent<FunctionTemplate> ServerCredentials::fun_tpl; Persistent<FunctionTemplate> ServerCredentials::fun_tpl;
ServerCredentials::ServerCredentials(grpc_server_credentials *credentials) ServerCredentials::ServerCredentials(grpc_server_credentials *credentials)
@ -68,16 +66,17 @@ ServerCredentials::~ServerCredentials() {
void ServerCredentials::Init(Handle<Object> exports) { void ServerCredentials::Init(Handle<Object> exports) {
NanScope(); NanScope();
Local<FunctionTemplate> tpl = FunctionTemplate::New(New); Local<FunctionTemplate> tpl = NanNew<FunctionTemplate>(New);
tpl->SetClassName(NanNew("ServerCredentials")); tpl->SetClassName(NanNew("ServerCredentials"));
tpl->InstanceTemplate()->SetInternalFieldCount(1); tpl->InstanceTemplate()->SetInternalFieldCount(1);
NanAssignPersistent(fun_tpl, tpl); NanAssignPersistent(fun_tpl, tpl);
NanAssignPersistent(constructor, tpl->GetFunction()); Handle<Function> ctr = tpl->GetFunction();
constructor->Set(NanNew("createSsl"), ctr->Set(NanNew("createSsl"),
FunctionTemplate::New(CreateSsl)->GetFunction()); NanNew<FunctionTemplate>(CreateSsl)->GetFunction());
constructor->Set(NanNew("createFake"), ctr->Set(NanNew("createFake"),
FunctionTemplate::New(CreateFake)->GetFunction()); NanNew<FunctionTemplate>(CreateFake)->GetFunction());
exports->Set(NanNew("ServerCredentials"), constructor); constructor = new NanCallback(ctr);
exports->Set(NanNew("ServerCredentials"), ctr);
} }
bool ServerCredentials::HasInstance(Handle<Value> val) { bool ServerCredentials::HasInstance(Handle<Value> val) {
@ -93,8 +92,8 @@ Handle<Value> ServerCredentials::WrapStruct(
} }
const int argc = 1; const int argc = 1;
Handle<Value> argv[argc] = { Handle<Value> argv[argc] = {
External::New(reinterpret_cast<void *>(credentials))}; NanNew<External>(reinterpret_cast<void *>(credentials))};
return NanEscapeScope(constructor->NewInstance(argc, argv)); return NanEscapeScope(constructor->GetFunction()->NewInstance(argc, argv));
} }
grpc_server_credentials *ServerCredentials::GetWrappedServerCredentials() { grpc_server_credentials *ServerCredentials::GetWrappedServerCredentials() {
@ -109,15 +108,16 @@ NAN_METHOD(ServerCredentials::New) {
return NanThrowTypeError( return NanThrowTypeError(
"ServerCredentials can only be created with the provide functions"); "ServerCredentials can only be created with the provide functions");
} }
Handle<External> ext = args[0].As<External>();
grpc_server_credentials *creds_value = grpc_server_credentials *creds_value =
reinterpret_cast<grpc_server_credentials *>(External::Unwrap(args[0])); reinterpret_cast<grpc_server_credentials *>(ext->Value());
ServerCredentials *credentials = new ServerCredentials(creds_value); ServerCredentials *credentials = new ServerCredentials(creds_value);
credentials->Wrap(args.This()); credentials->Wrap(args.This());
NanReturnValue(args.This()); NanReturnValue(args.This());
} else { } else {
const int argc = 1; const int argc = 1;
Local<Value> argv[argc] = {args[0]}; Local<Value> argv[argc] = {args[0]};
NanReturnValue(constructor->NewInstance(argc, argv)); NanReturnValue(constructor->GetFunction()->NewInstance(argc, argv));
} }
} }
@ -126,20 +126,20 @@ NAN_METHOD(ServerCredentials::CreateSsl) {
NanScope(); NanScope();
char *root_certs = NULL; char *root_certs = NULL;
grpc_ssl_pem_key_cert_pair key_cert_pair; grpc_ssl_pem_key_cert_pair key_cert_pair;
if (Buffer::HasInstance(args[0])) { if (::node::Buffer::HasInstance(args[0])) {
root_certs = Buffer::Data(args[0]); root_certs = ::node::Buffer::Data(args[0]);
} else if (!(args[0]->IsNull() || args[0]->IsUndefined())) { } else if (!(args[0]->IsNull() || args[0]->IsUndefined())) {
return NanThrowTypeError( return NanThrowTypeError(
"createSSl's first argument must be a Buffer if provided"); "createSSl's first argument must be a Buffer if provided");
} }
if (!Buffer::HasInstance(args[1])) { if (!::node::Buffer::HasInstance(args[1])) {
return NanThrowTypeError("createSsl's second argument must be a Buffer"); return NanThrowTypeError("createSsl's second argument must be a Buffer");
} }
key_cert_pair.private_key = Buffer::Data(args[1]); key_cert_pair.private_key = ::node::Buffer::Data(args[1]);
if (!Buffer::HasInstance(args[2])) { if (!::node::Buffer::HasInstance(args[2])) {
return NanThrowTypeError("createSsl's third argument must be a Buffer"); return NanThrowTypeError("createSsl's third argument must be a Buffer");
} }
key_cert_pair.cert_chain = Buffer::Data(args[2]); key_cert_pair.cert_chain = ::node::Buffer::Data(args[2]);
NanReturnValue(WrapStruct( NanReturnValue(WrapStruct(
grpc_ssl_server_credentials_create(root_certs, &key_cert_pair, 1))); grpc_ssl_server_credentials_create(root_certs, &key_cert_pair, 1)));
} }

@ -64,7 +64,7 @@ class ServerCredentials : public ::node::ObjectWrap {
static NAN_METHOD(New); static NAN_METHOD(New);
static NAN_METHOD(CreateSsl); static NAN_METHOD(CreateSsl);
static NAN_METHOD(CreateFake); static NAN_METHOD(CreateFake);
static v8::Persistent<v8::Function> constructor; static NanCallback *constructor;
// Used for typechecking instances of this javascript class // Used for typechecking instances of this javascript class
static v8::Persistent<v8::FunctionTemplate> fun_tpl; static v8::Persistent<v8::FunctionTemplate> fun_tpl;

Loading…
Cancel
Save