From fd98b77dfea09c0481b0e8be1204b6439eea80da Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 3 Dec 2020 02:12:13 +0100
Subject: [PATCH] Fix faulty main loop, comment out inactive cause buggy) flood
 protection.

---
 plomrogue/io.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/plomrogue/io.py b/plomrogue/io.py
index 252fac1..8110647 100644
--- a/plomrogue/io.py
+++ b/plomrogue/io.py
@@ -17,19 +17,22 @@ class GameIO():
         """Handle commands coming through queue q, run game, send results back.
 
         As basic flood protection, Only accepts one command per connection per
-        1/100 of a second.
+        1/100 of a second (currently commented out).
 
         """
         import time
         potential_flooders = {}
         while True:
             try:
-                command, connection_id = q.get(timeout=0.001)
-                if connection_id in potential_flooders:
-                    if int(time.time() * 100) == potential_flooders[connection_id]:
-                        continue
-                potential_flooders[connection_id] = int(time.time() * 100)
-                self.handle_input(connection_id, command)
+                connection_id, command = q.get(timeout=0.001)
+
+                # FIXME: this would catch the init command flood
+                #if connection_id in potential_flooders:
+                #    if int(time.time() * 100) == potential_flooders[connection_id]:
+                #        continue
+                #potential_flooders[connection_id] = int(time.time() * 100)
+
+                self.handle_input(command, connection_id)
             except queue.Empty:
                 self.game.run_tick()
 
@@ -38,6 +41,7 @@ class GameIO():
 
         The game loop works sequentially through game commands received
         via self.queue from connected servers' clients."""
+
         self.queue = queue.Queue()
         c = threading.Thread(target=self.loop, args=(self.queue,))
         c.start()
-- 
2.30.2