From 8ecb170151e061f35d3799885ba63b5762f2057e Mon Sep 17 00:00:00 2001
From: Craig Tiller <craig.tiller@gmail.com>
Date: Tue, 24 Feb 2015 17:08:23 -0800
Subject: [PATCH] Fix that race better

---
 test/cpp/qps/client.cc               | 4 ++--
 test/cpp/qps/server.cc               | 4 ++--
 test/cpp/qps/single_run_localhost.sh | 3 ---
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/test/cpp/qps/client.cc b/test/cpp/qps/client.cc
index 214711e205..7c9763a332 100644
--- a/test/cpp/qps/client.cc
+++ b/test/cpp/qps/client.cc
@@ -233,11 +233,11 @@ static void RunServer() {
 }
 
 int main(int argc, char **argv) {
+  signal(SIGINT, sigint_handler);
+
   grpc_init();
   ParseCommandLineFlags(&argc, &argv, true);
 
-  signal(SIGINT, sigint_handler);
-
   RunServer();
 
   grpc_shutdown();
diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc
index 89fdfeb0cb..7d9a9d1d28 100644
--- a/test/cpp/qps/server.cc
+++ b/test/cpp/qps/server.cc
@@ -185,11 +185,11 @@ static void RunServer() {
 }
 
 int main(int argc, char** argv) {
+  signal(SIGINT, sigint_handler);
+
   grpc_init();
   ParseCommandLineFlags(&argc, &argv, true);
 
-  signal(SIGINT, sigint_handler);
-
   GPR_ASSERT(FLAGS_port != 0);
   RunServer();
 
diff --git a/test/cpp/qps/single_run_localhost.sh b/test/cpp/qps/single_run_localhost.sh
index 317202a6ab..310a0824bb 100755
--- a/test/cpp/qps/single_run_localhost.sh
+++ b/test/cpp/qps/single_run_localhost.sh
@@ -19,9 +19,6 @@ SERVER_PID=$!
 bins/$config/qps_client -driver_port 10001 &
 CLIENT_PID=$!
 
-# wait for startup
-sleep 2
-
 export QPS_SERVERS=localhost:10000
 export QPS_CLIENTS=localhost:10001
 
-- 
GitLab