From 03c0941962d5ed90da4dca8671a1d2dfb5090f39 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sun, 6 Nov 2016 19:23:00 +0100 Subject: [PATCH] Add safety-measure to ensure clients disconnect at server stop --- tsstats/log.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tsstats/log.py b/tsstats/log.py index c5ce0a1..c58532a 100644 --- a/tsstats/log.py +++ b/tsstats/log.py @@ -159,6 +159,13 @@ def _parse_details(log_path, ident_map=None, clients=None, online_dc=True): invoker.ban(client) else: invoker.kick(client) + elif message == 'stopped': + # make sure all clients are disconnected at server stop + [ + client.disconnect(logdatetime) + for client in clients + if client.connected + ] if online_dc: def _reconnect(client): client.disconnect(datetime.utcnow())