From 189d685cc5917e221a699615a14de7939754af3c Mon Sep 17 00:00:00 2001
From: Ken Payson <kpayson@google.com>
Date: Sat, 9 Jul 2016 15:58:18 -0700
Subject: [PATCH] Added timeout to port server

---
 tools/run_tests/port_server.py | 7 ++++++-
 tools/run_tests/run_tests.py   | 4 ----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/run_tests/port_server.py b/tools/run_tests/port_server.py
index e2be26d182..83f8e6cd35 100755
--- a/tools/run_tests/port_server.py
+++ b/tools/run_tests/port_server.py
@@ -42,7 +42,7 @@ import time
 # increment this number whenever making a change to ensure that
 # the changes are picked up by running CI servers
 # note that all changes must be backwards compatible
-_MY_VERSION = 8
+_MY_VERSION = 9
 
 
 if len(sys.argv) == 2 and sys.argv[1] == 'dump_version':
@@ -110,6 +110,11 @@ keep_running = True
 
 
 class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
+  
+  def setup(self):
+    # If the client is unreachable for 5 seconds, close the connection
+    self.timeout = 5
+    BaseHTTPServer.BaseHTTPRequestHandler.setup(self)
 
   def do_GET(self):
     global keep_running
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 3bc83c2479..b0e20698bd 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -1094,10 +1094,6 @@ def _shut_down_legacy_server(legacy_server_port):
 
 
 def _start_port_server(port_server_port):
-  # Temporary patch to switch the port_server port
-  # see https://github.com/grpc/grpc/issues/7145
-  _shut_down_legacy_server(32767)
-
   # check if a compatible port server is running
   # if incompatible (version mismatch) ==> start a new one
   # if not running ==> start a new one
-- 
GitLab