code: def mainloop(self):
          
          try:
              while (not self.ev_quit.is_set()):
                  try:
                      self.handle_request()
  
                  except socketTimeout:
                      continue
          finally:
              self.socket.close()
docs: main control loop.