aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_select.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-09-27 17:28:56 +0100
committerMatthew Wild <mwild1@gmail.com>2011-09-27 17:28:56 +0100
commit1c3f397779097b8d99148ddafaabe55fb5fa551f (patch)
tree556bdcbf5b192b02f9a4fdd841799fbf33027d7d /net/server_select.lua
parent937263b7a5070a8f6bc8256004b9ecce68f0a27a (diff)
downloadprosody-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.lua7
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