From: Darren Date: Wed, 3 Apr 2013 18:29:21 +0000 (+0100) Subject: Connection limiting X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=83c25bfac81bb85de6fb91f4081feee72c0164dc;p=KiwiIRC.git Connection limiting --- 83c25bfac81bb85de6fb91f4081feee72c0164dc diff --cc server/irc/state.js index cd99df4,4b368c1..4f3f764 --- a/server/irc/state.js +++ b/server/irc/state.js @@@ -35,6 -36,17 +36,17 @@@ module.exports = State State.prototype.connect = function (hostname, port, ssl, nick, user, pass, callback) { var that = this; var con, con_num; - ++ + // Check the per-server limit on the number of connections + if ((global.config.max_server_conns > 0) && + (!global.config.restrict_server) && + (!(global.config.webirc_pass && global.config.webirc_pass[hostname])) && + (!(global.config.ip_as_username && _.contains(global.config.ip_as_username, hostname))) && + (global.servers.numOnHost(hostname) >= global.config.max_server_conns)) + { + return callback('Too many connections to host', {host: hostname, limit: global.config.max_server_conns}); + } + con = new IrcConnection( hostname, port,