# HG changeset patch # User Matthew Wild # Date 1317140936 -3600 # Node ID eded80beab5870d1061739b6ef31b110f67923ed # Parent 06161b0b83f272a6537790dfe5dbf7e6ff668c57 net.server_select: Never call onincoming with nil data when a listener doesn't have an onconnect handler diff -r 06161b0b83f2 -r eded80beab58 net/server_select.lua --- 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