Skip to content

Commit 51a292e

Browse files
committed
flag to disable flood protection
1 parent 655dff7 commit 51a292e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/InfoLogger.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ class InfoLogger::Impl
301301

302302
// message flood prevention
303303
// constants
304+
const bool flood_protection = 1; // if set, flood protection mechanism enabled
304305
const unsigned int flood_maxmsg_sec=500; // maximum messages in one second to trigger flood
305306
const unsigned int flood_maxmsg_min=1000; // maximum messages in one minute to trigger flood
306307
const unsigned int flood_maxmsg_file=1000; // maximum number of messages in overflow log file
@@ -475,6 +476,8 @@ int InfoLogger::Impl::pushMessage(const InfoLoggerMessageOption& options, const
475476
InfoLoggerMessageHelperSetValue(msg, msgHelper.ix_username, String, context.userName.c_str());
476477
}
477478

479+
if (flood_protection) {
480+
478481
// update message statistics */
479482
if (now-floodStat_time_lastsec>1) {
480483
floodStat_time_lastsec=now;
@@ -547,7 +550,8 @@ int InfoLogger::Impl::pushMessage(const InfoLoggerMessageOption& options, const
547550
floodReset();
548551
}
549552
}
550-
553+
}
554+
551555
if (client != nullptr) {
552556
char buffer[LOG_MAX_SIZE];
553557
msgHelper.MessageToText(&msg, buffer, sizeof(buffer), InfoLoggerMessageHelper::Format::Encoded);

0 commit comments

Comments
 (0)