aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/microbenchmarks
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreek@google.com>2018-02-06 23:45:05 -0800
committerGravatar Sree Kuchibhotla <sreek@google.com>2018-02-06 23:45:15 -0800
commit3293da3ca34e1982fb833326f02d18dce3782672 (patch)
tree9051cd723f2b43cff5d0d996a943ba66fea3e285 /test/cpp/microbenchmarks
parentfb369d95677b85995071e8255230c8bd7e291216 (diff)
Change the Fixture shutdown code so that the server fds are still polled
(to flush out any writes) when the server is shutdown.
Diffstat (limited to 'test/cpp/microbenchmarks')
-rw-r--r--test/cpp/microbenchmarks/fullstack_fixtures.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h
index d73caa01c8..fdc04e51c6 100644
--- a/test/cpp/microbenchmarks/fullstack_fixtures.h
+++ b/test/cpp/microbenchmarks/fullstack_fixtures.h
@@ -61,6 +61,15 @@ class FixtureConfiguration {
class BaseFixture : public TrackCounters {};
+// Special tag to be used in Server shutdown. This tag is *NEVER* returned when
+// Cq->Next() API is called (This is because FinalizeResult() function in this
+// class always returns 'false'). This is intentional and makes writing shutdown
+// code easier.
+class ShutdownTag : public internal::CompletionQueueTag {
+ public:
+ bool FinalizeResult(void** tag, bool* status) { return false; }
+};
+
class FullstackFixture : public BaseFixture {
public:
FullstackFixture(Service* service, const FixtureConfiguration& config,
@@ -84,7 +93,11 @@ class FullstackFixture : public BaseFixture {
}
virtual ~FullstackFixture() {
- server_->Shutdown(gpr_inf_past(GPR_CLOCK_MONOTONIC));
+ // Dummy shutdown tag (this tag is swallowed by cq->Next() and is not
+ // returned to the user) see ShutdownTag definition for more details
+ ShutdownTag shutdown_tag;
+ grpc_server_shutdown_and_notify(server_->c_server(), cq_->cq(),
+ &shutdown_tag);
cq_->Shutdown();
void* tag;
bool ok;
@@ -208,7 +221,11 @@ class EndpointPairFixture : public BaseFixture {
}
virtual ~EndpointPairFixture() {
- server_->Shutdown(gpr_inf_past(GPR_CLOCK_MONOTONIC));
+ // Dummy shutdown tag (this tag is swallowed by cq->Next() and is not
+ // returned to the user) see ShutdownTag definition for more details
+ ShutdownTag shutdown_tag;
+ grpc_server_shutdown_and_notify(server_->c_server(), cq_->cq(),
+ &shutdown_tag);
cq_->Shutdown();
void* tag;
bool ok;