equal
deleted
inserted
replaced
342 |
342 |
343 -- Network Listener Methods |
343 -- Network Listener Methods |
344 local listener = {}; |
344 local listener = {}; |
345 |
345 |
346 function listener.onconnect(conn) |
346 function listener.onconnect(conn) |
|
347 -- Silently drop connections with an IP address of <nil>, which can happen when the socket was closed before the |
|
348 -- responsible net.server backend was able to grab the IP address of the connecting client. |
|
349 if conn:ip() == nil then |
|
350 conn:close(); |
|
351 return; |
|
352 end |
|
353 |
347 -- Check if connection is coming from a trusted proxy |
354 -- Check if connection is coming from a trusted proxy |
348 if not is_trusted_proxy(conn) then |
355 if not is_trusted_proxy(conn) then |
349 conn:close(); |
356 conn:close(); |
350 module:log("warn", "Dropped connection from untrusted proxy: %s", conn:ip()); |
357 module:log("warn", "Dropped connection from untrusted proxy: %s", conn:ip()); |
351 return; |
358 return; |