diff --git a/ext/call.cc b/ext/call.cc index 3256f41d..a720f9ee 100644 --- a/ext/call.cc +++ b/ext/call.cc @@ -464,10 +464,6 @@ void Call::Init(Handle exports) { NanNew(GetPeer)->GetFunction()); NanAssignPersistent(fun_tpl, tpl); Handle ctr = tpl->GetFunction(); - ctr->Set(NanNew("WRITE_BUFFER_HINT"), - NanNew(GRPC_WRITE_BUFFER_HINT)); - ctr->Set(NanNew("WRITE_NO_COMPRESS"), - NanNew(GRPC_WRITE_NO_COMPRESS)); exports->Set(NanNew("Call"), ctr); constructor = new NanCallback(ctr); } diff --git a/ext/node_grpc.cc b/ext/node_grpc.cc index d93dafda..0cf30da9 100644 --- a/ext/node_grpc.cc +++ b/ext/node_grpc.cc @@ -196,6 +196,16 @@ void InitConnectivityStateConstants(Handle exports) { channel_state->Set(NanNew("FATAL_FAILURE"), FATAL_FAILURE); } +void InitWriteFlags(Handle exports) { + NanScope(); + Handle write_flags = NanNew(); + exports->Set(NanNew("writeFlags"), write_flags); + Handle BUFFER_HINT(NanNew(GRPC_WRITE_BUFFER_HINT)); + write_flags->Set(NanNew("BUFFER_HINT"), BUFFER_HINT); + Handle NO_COMPRESS(NanNew(GRPC_WRITE_NO_COMPRESS)); + write_flags->Set(NanNew("NO_COMPRESS"), NO_COMPRESS); +} + void init(Handle exports) { NanScope(); grpc_init(); @@ -204,6 +214,7 @@ void init(Handle exports) { InitOpTypeConstants(exports); InitPropagateConstants(exports); InitConnectivityStateConstants(exports); + InitWriteFlags(exports); grpc::node::Call::Init(exports); grpc::node::Channel::Init(exports); diff --git a/index.js b/index.js index 93c65ac5..889b0ac0 100644 --- a/index.js +++ b/index.js @@ -144,6 +144,11 @@ exports.propagate = grpc.propagate; */ exports.callError = grpc.callError; +/** + * Write flag name to code number mapping + */ +exports.writeFlags = grpc.writeFlags; + /** * Credentials factories */