File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
iroh/src/magicsock/node_map Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -121,11 +121,19 @@ impl BestAddr {
121
121
}
122
122
Some ( state) => {
123
123
let candidate = AddrLatency { addr, latency } ;
124
+ // If the current address has exceeded its trust interval, or if the new address has lower latency,
125
+ // use the new address.
124
126
if !state. is_trusted ( confirmed_at) || candidate. is_better_than ( & state. addr ) {
125
127
self . insert ( addr, latency, source, confirmed_at) ;
128
+ // If the new address is equal to the current address, mark it as reconfirmed now and expand its trust
129
+ // interval.
126
130
} else if state. addr . addr == addr {
127
131
state. confirmed_at = confirmed_at;
128
132
state. trust_until = Some ( source. trust_until ( confirmed_at) ) ;
133
+ // If we receive a pong on a different port but the same IP address as the current best addr,
134
+ // we assume that the endpoint has rebound, and thus use the new port.
135
+ } else if state. addr . addr . ip ( ) == addr. ip ( ) {
136
+ self . insert ( addr, latency, source, confirmed_at)
129
137
}
130
138
}
131
139
}
You can’t perform that action at this time.
0 commit comments