aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-01-22 01:58:39 +0100
committerKim Alvefur <zash@zash.se>2016-01-22 01:58:39 +0100
commitf4631dda0590cb3db8c4f0c350b455be8408b52f (patch)
tree1524943a561d71bef64fba519830d2a5233f50c7 /net
parent2c31800ffd75921d142bceeb654b463b1c99b08f (diff)
downloadprosody-f4631dda0590cb3db8c4f0c350b455be8408b52f.tar.gz
prosody-f4631dda0590cb3db8c4f0c350b455be8408b52f.zip
server_select: Keep track of which server listeners are full
Diffstat (limited to 'net')
-rw-r--r--net/server_select.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index 7ac41523..0a060c9e 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -88,6 +88,7 @@ local _socketlist
local _closelist
local _readtimes
local _writetimes
+local _fullservers
--// simple data types //--
@@ -130,6 +131,7 @@ _socketlist = { } -- key = socket, value = wrapped socket (handlers)
_readtimes = { } -- key = handler, value = timestamp of last data reading
_writetimes = { } -- key = handler, value = timestamp of last data writing/sending
_closelist = { } -- handlers to close
+_fullservers = { } -- servers in a paused state while there are too many clients
_readlistlen = 0 -- length of readlist
_sendlistlen = 0 -- length of sendlist
@@ -219,6 +221,7 @@ wrapserver = function( listeners, socket, ip, serverport, pattern, sslctx ) -- t
end
_readlistlen = addsocket(_readlist, socket, _readlistlen)
_socketlist[ socket ] = handler
+ _fullservers[ handler ] = nil
handler.paused = false;
end
end
@@ -234,6 +237,7 @@ wrapserver = function( listeners, socket, ip, serverport, pattern, sslctx ) -- t
handler.readbuffer = function( )
if _readlistlen >= _maxselectlen or _sendlistlen >= _maxselectlen then
handler.pause( )
+ _fullservers[ handler ] = _currenttime
out_put( "server.lua: refused new client connection: server full" )
return false
end
@@ -264,6 +268,7 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
out_error("server.lua: Disallowed FD number: "..socket:getfd()) -- PROTIP: Switch to libevent
socket:close( ) -- Should we send some kind of error here?
if server then
+ _fullservers[ server ] = _currenttime
server.pause( )
end
return nil, nil, "fd-too-large"