summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/master/messages.c13
-rw-r--r--src/master/servers.h4
2 files changed, 14 insertions, 3 deletions
diff --git a/src/master/messages.c b/src/master/messages.c
index b30bc334..90fb223c 100644
--- a/src/master/messages.c
+++ b/src/master/messages.c
@@ -544,9 +544,16 @@ void HandleMessage (const char* msg, size_t length,
HandleGetMotd (msg + strlen (C2M_GETMOTD), address);
}
- // If it's a game statistic
+ // If it's a game statistic
else if( !strncmp( S2M_GAMESTAT, msg, strlen ( S2M_GAMESTAT ) ) )
- {
- HandleGameStat( msg + strlen( S2M_GAMESTAT ), address );
+ {
+ server = Sv_GetByAddr(address, qfalse);
+ if (server == NULL)
+ return;
+ if( crt_time - server->lastGameStat > MIN_GAMESTAT_DELAY )
+ HandleGameStat( msg + strlen( S2M_GAMESTAT ), address );
+ else
+ MsgPrint( MSG_NORMAL, "%s flooding GAMESTAT messages\n", peer_address );
+ server->lastGameStat = crt_time;
}
}
diff --git a/src/master/servers.h b/src/master/servers.h
index fbeef1c2..8165b66b 100644
--- a/src/master/servers.h
+++ b/src/master/servers.h
@@ -38,6 +38,9 @@
#define CHALLENGE_MIN_LENGTH 9
#define CHALLENGE_MAX_LENGTH 12
+// Minimum number of seconds between gamestat messages per server
+#define MIN_GAMESTAT_DELAY 120
+
// ---------- Types ---------- //
// Address mapping
@@ -63,6 +66,7 @@ typedef struct server_s
time_t challenge_timeout;
const struct addrmap_s* addrmap;
qboolean active;
+ time_t lastGameStat;
} server_t;