Allow local connections only.
Use threading.Event() instead of a simple variable.
Add exception raised to the logs.