Changeset

4388:eded80beab58

net.server_select: Never call onincoming with nil data when a listener doesn't have an onconnect handler
author Matthew Wild <mwild1@gmail.com>
date Tue, 27 Sep 2011 17:28:56 +0100
parents 4387:06161b0b83f2
children 4389:886eebf10802
files net/server_select.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_select.lua	Sun Sep 25 00:21:22 2011 +0100
+++ b/net/server_select.lua	Tue Sep 27 17:28:56 2011 +0100
@@ -173,7 +173,7 @@
 
 	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 @@
 			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