Only delete core-level server if shutdown was successful

pull/10563/head
murgatroid99 8 years ago
parent 803392e9f1
commit 017a335d2b
  1. 19
      src/node/ext/call.cc
  2. 2
      src/node/ext/call.h
  3. 6
      src/node/ext/server.cc
  4. 4
      src/node/ext/server_uv.cc

@ -217,7 +217,7 @@ class SendMetadataOp : public Op {
bool IsFinalOp() {
return false;
}
void OnComplete() {
void OnComplete(bool success) {
}
protected:
std::string GetTypeString() const {
@ -262,7 +262,7 @@ class SendMessageOp : public Op {
bool IsFinalOp() {
return false;
}
void OnComplete() {
void OnComplete(bool success) {
}
protected:
std::string GetTypeString() const {
@ -284,7 +284,7 @@ class SendClientCloseOp : public Op {
bool IsFinalOp() {
return false;
}
void OnComplete() {
void OnComplete(bool success) {
}
protected:
std::string GetTypeString() const {
@ -355,7 +355,7 @@ class SendServerStatusOp : public Op {
bool IsFinalOp() {
return true;
}
void OnComplete() {
void OnComplete(bool success) {
}
protected:
std::string GetTypeString() const {
@ -389,7 +389,7 @@ class GetMetadataOp : public Op {
bool IsFinalOp() {
return false;
}
void OnComplete() {
void OnComplete(bool success) {
}
protected:
@ -423,7 +423,7 @@ class ReadMessageOp : public Op {
bool IsFinalOp() {
return false;
}
void OnComplete() {
void OnComplete(bool success) {
}
protected:
@ -466,7 +466,7 @@ class ClientStatusOp : public Op {
bool IsFinalOp() {
return true;
}
void OnComplete() {
void OnComplete(bool success) {
}
protected:
std::string GetTypeString() const {
@ -492,7 +492,7 @@ class ServerCloseResponseOp : public Op {
bool IsFinalOp() {
return false;
}
void OnComplete() {
void OnComplete(bool success) {
}
protected:
@ -532,11 +532,12 @@ void CompleteTag(void *tag, const char *error_message) {
Local<Value> argv[] = {Nan::Error(error_message)};
callback->Call(1, argv);
}
bool success = (error_message == NULL);
bool is_final_op = false;
for (vector<unique_ptr<Op> >::iterator it = tag_struct->ops->begin();
it != tag_struct->ops->end(); ++it) {
Op *op_ptr = it->get();
op_ptr->OnComplete();
op_ptr->OnComplete(success);
if (op_ptr->IsFinalOp()) {
is_final_op = true;
}

@ -106,7 +106,7 @@ class Op {
virtual ~Op();
v8::Local<v8::Value> GetOpType() const;
virtual bool IsFinalOp() = 0;
virtual void OnComplete() = 0;
virtual void OnComplete(bool success) = 0;
protected:
virtual std::string GetTypeString() const = 0;

@ -117,7 +117,7 @@ class NewCallOp : public Op {
bool IsFinalOp() {
return false;
}
void OnComplete() {
void OnComplete(bool success) {
}
grpc_call *call;
@ -143,9 +143,11 @@ class TryShutdownOp: public Op {
bool IsFinalOp() {
return false;
}
void OnComplete() {
void OnComplete(bool success) {
if (success) {
server->DestroyWrappedServer();
}
}
protected:
std::string GetTypeString() const { return "try_shutdown"; }
private:

@ -76,7 +76,9 @@ class ServerShutdownOp : public Op {
bool IsFinalOp() {
return false;
}
void OnComplete() {
void OnComplete(bool success) {
/* Because cancel_all_calls was called, we assume that shutdown_and_notify
completes successfully */
grpc_server_destroy(server);
}

Loading…
Cancel
Save