diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-09-27 17:28:56 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-09-27 17:28:56 +0100 |
commit | 1c3f397779097b8d99148ddafaabe55fb5fa551f (patch) | |
tree | 556bdcbf5b192b02f9a4fdd841799fbf33027d7d /net/server_select.lua | |
parent | 937263b7a5070a8f6bc8256004b9ecce68f0a27a (diff) | |
download | prosody-1c3f397779097b8d99148ddafaabe55fb5fa551f.tar.gz prosody-1c3f397779097b8d99148ddafaabe55fb5fa551f.zip |
net.server_select: Never call onincoming with nil data when a listener doesn't have an onconnect handler
Diffstat (limited to 'net/server_select.lua')
-rw-r--r-- | net/server_select.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/server_select.lua b/net/server_select.lua index 41f2b9fa..c4f08d32 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -173,7 +173,7 @@ wrapserver = function( listeners, socket, ip, serverport, pattern, sslctx, maxco local connections = 0 - local dispatch, disconnect = listeners.onconnect or listeners.onincoming, listeners.ondisconnect + local dispatch, disconnect = listeners.onconnect, listeners.ondisconnect local accept = socket.accept @@ -232,7 +232,10 @@ wrapserver = function( listeners, socket, ip, serverport, pattern, sslctx, maxco end connections = connections + 1 out_put( "server.lua: accepted new client connection from ", tostring(ip), ":", tostring(clientport), " to ", tostring(serverport)) - return dispatch( handler ) + if dispatch then + return dispatch( handler ); + end + return; elseif err then -- maybe timeout or something else out_put( "server.lua: error with new client connection: ", tostring(err) ) return false |