def _main(self): """ The main procedure of the thread. Runs server and is expected to be either stopped by the user with KeyboardInterrupt or killed when the program exits. Exceptions are passed to the main thread through queue passed to the constructor. """ try: httpd = TCPServer(("", self.port), ReportingHTTPRequestHandler) logger.info("Starting HTTP server at port %d\n", self.port) httpd.probe_data_provider = self.probe_data_provider httpd.serve_forever() except: logger.debug("An exception has interrupted the server thread (passed to the main thread)") self.exception_queue.put(sys.exc_info())