Comparison

net/connect.lua @ 12468:353836684009

net.connect: Fix accumulation of connection attempt references Connection attempts that failed the Happy Eyeballs race were not unreferenced and would accumulate. Tested by inspecting the 'pending_connections_map' after establishing s2s with a s2s target where the IPv6 port has a -j DROP rule causing it to time out and the IPv4 attempt wins the race. Expected is that the losing connection stays around until net.server timeouts kick in where it should be removed. The map table should tend towards being empty during idle times.
author Kim Alvefur <zash@zash.se>
date Wed, 20 Apr 2022 22:41:54 +0200
parent 12426:7a3da1acace1
child 12639:6d9ee0a3eb4b
comparison
equal deleted inserted replaced
12467:ccbdebb43e23 12468:353836684009
89 if not p then 89 if not p then
90 log("warn", "Failed connection, but unexpected!"); 90 log("warn", "Failed connection, but unexpected!");
91 return; 91 return;
92 end 92 end
93 p.conns[conn] = nil; 93 p.conns[conn] = nil;
94 pending_connections_map[conn] = nil;
94 p.last_error = reason or "unknown reason"; 95 p.last_error = reason or "unknown reason";
95 p:log("debug", "Connection attempt failed: %s", p.last_error); 96 p:log("debug", "Connection attempt failed: %s", p.last_error);
96 if p.connected then 97 if p.connected then
97 p:log("debug", "Connection already established, ignoring failure"); 98 p:log("debug", "Connection already established, ignoring failure");
98 elseif next(p.conns) == nil then 99 elseif next(p.conns) == nil then