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 | b07e6ff42eba66c6dd1af02da6964136f16a53df (patch) | |
tree | 556bdcbf5b192b02f9a4fdd841799fbf33027d7d | |
parent | 63d6d1a502ad62b46ff1c6517c87c4601d50be02 (diff) | |
download | prosody-b07e6ff42eba66c6dd1af02da6964136f16a53df.tar.gz prosody-b07e6ff42eba66c6dd1af02da6964136f16a53df.zip |
net.server_select: Never call onincoming with nil data when a listener doesn't have an onconnect handler
-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 |