aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-05-04 14:53:51 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-05-04 14:53:51 -0700
commit64be9f7a30a4bcb9ce3647f11ba9e06994aa3bb7 (patch)
tree42a4af35a2fe0f3a79573ff37130fd6b74c55cb9 /src/node
parentc112d146a2dcc5e90d5f5cca10f55f212f9492c6 (diff)
C Core API cleanup.
Simplify grpc_event into something that can be non-heap allocated. Deprecate grpc_event_finish. Remove grpc_op_error - use an int as this is more idiomatic C style.
Diffstat (limited to 'src/node')
-rw-r--r--src/node/ext/completion_queue_async_worker.cc16
-rw-r--r--src/node/ext/completion_queue_async_worker.h2
2 files changed, 7 insertions, 11 deletions
diff --git a/src/node/ext/completion_queue_async_worker.cc b/src/node/ext/completion_queue_async_worker.cc
index 4e57121a85..4be208c82d 100644
--- a/src/node/ext/completion_queue_async_worker.cc
+++ b/src/node/ext/completion_queue_async_worker.cc
@@ -63,7 +63,7 @@ CompletionQueueAsyncWorker::~CompletionQueueAsyncWorker() {}
void CompletionQueueAsyncWorker::Execute() {
result = grpc_completion_queue_next(queue, gpr_inf_future);
- if (result->data.op_complete != GRPC_OP_OK) {
+ if (!result.success) {
SetErrorMessage("The batch encountered an error");
}
}
@@ -96,25 +96,21 @@ void CompletionQueueAsyncWorker::HandleOKCallback() {
} else {
current_threads -= 1;
}
- NanCallback *callback = GetTagCallback(result->tag);
- Handle<Value> argv[] = {NanNull(), GetTagNodeValue(result->tag)};
+ NanCallback *callback = GetTagCallback(result.tag);
+ Handle<Value> argv[] = {NanNull(), GetTagNodeValue(result.tag)};
callback->Call(2, argv);
- DestroyTag(result->tag);
- grpc_event_finish(result);
- result = NULL;
+ DestroyTag(result.tag);
}
void CompletionQueueAsyncWorker::HandleErrorCallback() {
NanScope();
- NanCallback *callback = GetTagCallback(result->tag);
+ NanCallback *callback = GetTagCallback(result.tag);
Handle<Value> argv[] = {NanError(ErrorMessage())};
callback->Call(1, argv);
- DestroyTag(result->tag);
- grpc_event_finish(result);
- result = NULL;
+ DestroyTag(result.tag);
}
} // namespace node
diff --git a/src/node/ext/completion_queue_async_worker.h b/src/node/ext/completion_queue_async_worker.h
index 5d52bbb1fb..27fedf2fce 100644
--- a/src/node/ext/completion_queue_async_worker.h
+++ b/src/node/ext/completion_queue_async_worker.h
@@ -70,7 +70,7 @@ class CompletionQueueAsyncWorker : public NanAsyncWorker {
void HandleErrorCallback();
private:
- grpc_event *result;
+ grpc_event result;
static grpc_completion_queue *queue;