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.
diff --git a/src/node/ext/completion_queue_async_worker.cc b/src/node/ext/completion_queue_async_worker.cc
index 4e57121..4be208c 100644
--- a/src/node/ext/completion_queue_async_worker.cc
+++ b/src/node/ext/completion_queue_async_worker.cc
@@ -63,7 +63,7 @@
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 @@
} 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 5d52bbb..27fedf2 100644
--- a/src/node/ext/completion_queue_async_worker.h
+++ b/src/node/ext/completion_queue_async_worker.h
@@ -70,7 +70,7 @@
void HandleErrorCallback();
private:
- grpc_event *result;
+ grpc_event result;
static grpc_completion_queue *queue;