Skip to content

Commit

Permalink
Shorten ResourceMonitor cflood messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Zarel committed Aug 20, 2016
1 parent 85e739f commit e3f1a3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions monitor.js
Expand Up @@ -85,13 +85,13 @@ const Monitor = module.exports = { // eslint-disable-line no-unused-vars
let count = val[0], duration = val[1];
name = (name ? ': ' + name : '');
if (count === 500) {
this.adminlog('[ResourceMonitor] IP ' + ip + ' has been banned for connection flooding (' + count + ' times in the last ' + Tools.toDurationString(duration) + name + ')');
this.adminlog('[ResourceMonitor] IP ' + ip + ' banned for cflooding (' + count + ' times in ' + Tools.toDurationString(duration) + name + ')');
return true;
} else if (count > 500) {
if (count % 500 === 0) {
let c = count / 500;
if (c === 2 || c === 4 || c === 10 || c === 20 || c % 40 === 0) {
this.adminlog('[ResourceMonitor] Banned IP ' + ip + ' has connected ' + count + ' times in the last ' + Tools.toDurationString(duration) + name);
this.adminlog('[ResourceMonitor] IP ' + ip + ' still cflooding (' + count + ' times in ' + Tools.toDurationString(duration) + name + ')');
}
}
return true;
Expand Down

0 comments on commit e3f1a3b

Please sign in to comment.