From e7b7dc932aecbfb3d9846b32119bf987cb29384b Mon Sep 17 00:00:00 2001 From: Nyo Date: Sat, 8 Oct 2016 22:37:10 +0200 Subject: [PATCH] .BANCHO. Add max packets buffer size --- events/changeActionEvent.py | 2 +- objects/osuToken.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/events/changeActionEvent.py b/events/changeActionEvent.py index e4d7670..15b5f4d 100644 --- a/events/changeActionEvent.py +++ b/events/changeActionEvent.py @@ -34,7 +34,7 @@ if userToken.matchID != -1 and userToken.actionID != actions.MULTIPLAYING and us userToken.partMatch() ''' - # Update cached stats if our pp changedm if we've just submitted a score or we've changed gameMode + # Update cached stats if our pp changed if we've just submitted a score or we've changed gameMode if (userToken.actionID == actions.PLAYING or userToken.actionID == actions.MULTIPLAYING) or (userToken.pp != userUtils.getPP(userID, userToken.gameMode)) or (userToken.gameMode != packetData["gameMode"]): # Always update game mode, or we'll cache stats from the wrong game mode if we've changed it userToken.gameMode = packetData["gameMode"] diff --git a/objects/osuToken.py b/objects/osuToken.py index 38ca08e..b52f00b 100644 --- a/objects/osuToken.py +++ b/objects/osuToken.py @@ -96,7 +96,10 @@ class token: bytes -- (packet) bytes to enqueue """ if not self.irc: - self.queue += bytes_ + if len(bytes_) < 10 * 10 ** 6: + self.queue += bytes_ + else: + log.warning("{}'s packets buffer is above 10M!! Lost some data!".format(self.username)) def resetQueue(self):