|
|
|
@ -113,8 +113,8 @@ class NewCallOp : public Op { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Server::Server(grpc_server *server) : wrapped_server(server) { |
|
|
|
|
shutdown_queue = grpc_completion_queue_create(); |
|
|
|
|
grpc_server_register_completion_queue(server, shutdown_queue); |
|
|
|
|
shutdown_queue = grpc_completion_queue_create(NULL); |
|
|
|
|
grpc_server_register_completion_queue(server, shutdown_queue, NULL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Server::~Server() { |
|
|
|
@ -162,7 +162,7 @@ void Server::ShutdownServer() { |
|
|
|
|
this->shutdown_queue, |
|
|
|
|
NULL); |
|
|
|
|
grpc_completion_queue_pluck(this->shutdown_queue, NULL, |
|
|
|
|
gpr_inf_future(GPR_CLOCK_REALTIME)); |
|
|
|
|
gpr_inf_future(GPR_CLOCK_REALTIME), NULL); |
|
|
|
|
this->wrapped_server = NULL; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -180,7 +180,7 @@ NAN_METHOD(Server::New) { |
|
|
|
|
grpc_server *wrapped_server; |
|
|
|
|
grpc_completion_queue *queue = CompletionQueueAsyncWorker::GetQueue(); |
|
|
|
|
if (args[0]->IsUndefined()) { |
|
|
|
|
wrapped_server = grpc_server_create(NULL); |
|
|
|
|
wrapped_server = grpc_server_create(NULL, NULL); |
|
|
|
|
} else if (args[0]->IsObject()) { |
|
|
|
|
Handle<Object> args_hash(args[0]->ToObject()); |
|
|
|
|
Handle<Array> keys(args_hash->GetOwnPropertyNames()); |
|
|
|
@ -209,12 +209,12 @@ NAN_METHOD(Server::New) { |
|
|
|
|
return NanThrowTypeError("Arg values must be strings"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
wrapped_server = grpc_server_create(&channel_args); |
|
|
|
|
wrapped_server = grpc_server_create(&channel_args, NULL); |
|
|
|
|
free(channel_args.args); |
|
|
|
|
} else { |
|
|
|
|
return NanThrowTypeError("Server expects an object"); |
|
|
|
|
} |
|
|
|
|
grpc_server_register_completion_queue(wrapped_server, queue); |
|
|
|
|
grpc_server_register_completion_queue(wrapped_server, queue, NULL); |
|
|
|
|
Server *server = new Server(wrapped_server); |
|
|
|
|
server->Wrap(args.This()); |
|
|
|
|
NanReturnValue(args.This()); |
|
|
|
@ -237,7 +237,7 @@ NAN_METHOD(Server::RequestCall) { |
|
|
|
|
CompletionQueueAsyncWorker::GetQueue(), |
|
|
|
|
CompletionQueueAsyncWorker::GetQueue(), |
|
|
|
|
new struct tag(new NanCallback(args[0].As<Function>()), ops.release(), |
|
|
|
|
shared_ptr<Resources>(nullptr))); |
|
|
|
|
shared_ptr<Resources>(NULL))); |
|
|
|
|
if (error != GRPC_CALL_OK) { |
|
|
|
|
return NanThrowError("requestCall failed", error); |
|
|
|
|
} |
|
|
|
|