From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 28 Dec 2020 10:17:42 +0000 (+0100)
Subject: Add login maximum.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/foo.html?a=commitdiff_plain;h=acbbf266ec7288bf7a22b7131f085a7e118b41d4;p=plomrogue2

Add login maximum.
---

diff --git a/plomrogue/game.py b/plomrogue/game.py
index e7bc730..ba982dd 100755
--- a/plomrogue/game.py
+++ b/plomrogue/game.py
@@ -349,6 +349,11 @@ class Game(GameBase):
         self.changed = True
 
     def login(self, nick, connection_id):
+        if len(self.sessions) > 200:
+            print('DEBUG LOGIN TOO MANY FOR', connection_id)
+            self.io.send('CHAT "sorry, too many users currenty '
+                         'logged in, try again later"')
+            return
         for t in [t for t in self.things
                   if t.type_ == 'Player' and t.name == nick]:
             self.io.send('GAME_ERROR ' + quote('name already in use'),