in fbtftp/base_server.py [0:0]
def run(self, run_once=False):
"""
Run the infinite serving loop.
Args:
run_once (bool): If True it will exit the loop after first
iteration. Note this is only used in unit tests.
"""
# First start of the server stats thread
self.restart_stats_timer(run_once)
while not self._should_stop:
self.run_once()
if run_once:
break
self._selector.close()
self._listener.close()
if self._metrics_timer is not None:
self._metrics_timer.cancel()