From 12ed9f7069c3d059e564699b0740655b5f3f1d7d Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Mon, 14 Nov 2016 08:01:00 +0900 Subject: [PATCH] Have session_count return a dictionary --- server/protocol.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/protocol.py b/server/protocol.py index 36528b2..4936604 100644 --- a/server/protocol.py +++ b/server/protocol.py @@ -156,7 +156,10 @@ class ServerManager(LoggedClass): return self.irc.peers def session_count(self): - return len(self.sessions) + '''Returns a dictionary.''' + active = len(s for s in self.sessions if s.send_count) + total = len(self.sessions) + return {'active': active, 'inert': total - active, 'total': total} def address_count(self): return sum(len(session.hash168s) for session in self.sessions