Changeset

2997:97b30fec709c

mod_net_proxy: Fixed errors when connection with nil ip is being processed
author Pascal Mathis <mail@pascalmathis.com>
date Thu, 05 Apr 2018 19:08:46 +0200
parents 2996:0fb95dc11bc8
children 2998:719b76ee0578
files mod_net_proxy/mod_net_proxy.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_net_proxy/mod_net_proxy.lua	Wed Apr 04 21:40:08 2018 +0200
+++ b/mod_net_proxy/mod_net_proxy.lua	Thu Apr 05 19:08:46 2018 +0200
@@ -344,6 +344,13 @@
 local listener = {};
 
 function listener.onconnect(conn)
+	-- Silently drop connections with an IP address of <nil>, which can happen when the socket was closed before the
+	-- responsible net.server backend was able to grab the IP address of the connecting client.
+	if conn:ip() == nil then
+		conn:close();
+		return;
+	end
+
 	-- Check if connection is coming from a trusted proxy
 	if not is_trusted_proxy(conn) then
 		conn:close();