|
|
@ -97,15 +97,15 @@ class AsyncQpsServerTest : public Server { |
|
|
|
bool ok; |
|
|
|
bool ok; |
|
|
|
void* got_tag; |
|
|
|
void* got_tag; |
|
|
|
while (srv_cq_.Next(&got_tag, &ok)) { |
|
|
|
while (srv_cq_.Next(&got_tag, &ok)) { |
|
|
|
ServerRpcContext* ctx = detag(got_tag); |
|
|
|
ServerRpcContext* ctx = detag(got_tag); |
|
|
|
// The tag is a pointer to an RPC context to invoke
|
|
|
|
// The tag is a pointer to an RPC context to invoke
|
|
|
|
if (ctx->RunNextState(ok) == false) { |
|
|
|
if (ctx->RunNextState(ok) == false) { |
|
|
|
// this RPC context is done, so refresh it
|
|
|
|
// this RPC context is done, so refresh it
|
|
|
|
std::lock_guard<std::mutex> g(shutdown_mutex_); |
|
|
|
std::lock_guard<std::mutex> g(shutdown_mutex_); |
|
|
|
if (!shutdown_) { |
|
|
|
if (!shutdown_) { |
|
|
|
ctx->Reset(); |
|
|
|
ctx->Reset(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
})); |
|
|
|
})); |
|
|
@ -175,8 +175,9 @@ class AsyncQpsServerTest : public Server { |
|
|
|
private: |
|
|
|
private: |
|
|
|
bool finisher(bool) { return false; } |
|
|
|
bool finisher(bool) { return false; } |
|
|
|
bool invoker(bool ok) { |
|
|
|
bool invoker(bool ok) { |
|
|
|
if (!ok) |
|
|
|
if (!ok) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ResponseType response; |
|
|
|
ResponseType response; |
|
|
|
|
|
|
|
|
|
|
@ -230,8 +231,9 @@ class AsyncQpsServerTest : public Server { |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
bool request_done(bool ok) { |
|
|
|
bool request_done(bool ok) { |
|
|
|
if (!ok) |
|
|
|
if (!ok) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
stream_.Read(&req_, AsyncQpsServerTest::tag(this)); |
|
|
|
stream_.Read(&req_, AsyncQpsServerTest::tag(this)); |
|
|
|
next_state_ = &ServerRpcContextStreamingImpl::read_done; |
|
|
|
next_state_ = &ServerRpcContextStreamingImpl::read_done; |
|
|
|
return true; |
|
|
|
return true; |
|
|
|