|  | @@ -33,18 +33,20 @@
 | 
	
		
			
				|  |  |  from __future__ import print_function
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import argparse
 | 
	
		
			
				|  |  | -from six.moves import BaseHTTPServer
 | 
	
		
			
				|  |  | +from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
 | 
	
		
			
				|  |  |  import hashlib
 | 
	
		
			
				|  |  |  import os
 | 
	
		
			
				|  |  |  import socket
 | 
	
		
			
				|  |  |  import sys
 | 
	
		
			
				|  |  |  import time
 | 
	
		
			
				|  |  | +from SocketServer import ThreadingMixIn
 | 
	
		
			
				|  |  | +import threading
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  # 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 = 9
 | 
	
		
			
				|  |  | +_MY_VERSION = 10
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  if len(sys.argv) == 2 and sys.argv[1] == 'dump_version':
 | 
	
	
		
			
				|  | @@ -111,12 +113,12 @@ def allocate_port(req):
 | 
	
		
			
				|  |  |  keep_running = True
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
 | 
	
		
			
				|  |  | +class Handler(BaseHTTPRequestHandler):
 | 
	
		
			
				|  |  |    
 | 
	
		
			
				|  |  |    def setup(self):
 | 
	
		
			
				|  |  |      # If the client is unreachable for 5 seconds, close the connection
 | 
	
		
			
				|  |  |      self.timeout = 5
 | 
	
		
			
				|  |  | -    BaseHTTPServer.BaseHTTPRequestHandler.setup(self)
 | 
	
		
			
				|  |  | +    BaseHTTPRequestHandler.setup(self)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    def do_GET(self):
 | 
	
		
			
				|  |  |      global keep_running
 | 
	
	
		
			
				|  | @@ -158,12 +160,12 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
 | 
	
		
			
				|  |  |      elif self.path == '/quitquitquit':
 | 
	
		
			
				|  |  |        self.send_response(200)
 | 
	
		
			
				|  |  |        self.end_headers()
 | 
	
		
			
				|  |  | -      keep_running = False
 | 
	
		
			
				|  |  | +      sys.exit(0)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
 | 
	
		
			
				|  |  | +  """Handle requests in a separate thread"""
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -httpd = BaseHTTPServer.HTTPServer(('', args.port), Handler)
 | 
	
		
			
				|  |  | -while keep_running:
 | 
	
		
			
				|  |  | -  httpd.handle_request()
 | 
	
		
			
				|  |  | -  sys.stderr.flush()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -print('done')
 | 
	
		
			
				|  |  | +httpd = ThreadedHTTPServer(('', args.port), Handler)
 | 
	
		
			
				|  |  | +httpd.serve_forever()
 | 
	
		
			
				|  |  | +
 |