client: re-attempt NAT traversal on all unconnected peers (#195)

fixes #173
pull/202/head
Jake McGinty 2022-02-03 01:49:51 +09:00 committed by GitHub
parent f7df6bab01
commit 6d26385ba3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -616,7 +616,7 @@ fn fetch(
Err(e) => return Err(e.into()),
_ => {},
}
log::debug!("reported candidates: {:?}", candidates);
log::debug!("candidates successfully reported");
if nat.no_nat_traversal {
log::debug!("NAT traversal explicitly disabled, not attempting.");

View File

@ -648,6 +648,7 @@ impl<'a> PeerDiff<'a> {
.map(|info| info.is_recently_connected())
.unwrap_or_default()
{
let mut endpoint_changed = false;
let resolved = new.endpoint.as_ref().and_then(|e| e.resolve().ok());
if let Some(addr) = resolved {
if old.is_none() || matches!(old, Some(old) if old.endpoint != resolved) {
@ -657,9 +658,18 @@ impl<'a> PeerDiff<'a> {
old.and_then(|p| p.endpoint),
Some(addr),
));
endpoint_changed = true;
}
}
if !endpoint_changed && !new.candidates.is_empty() {
changes.push(ChangeString::new(
"Connection status",
"Disconnected".into(),
"NAT traverse reattempt".into(),
));
}
}
if !changes.is_empty() {
Some((builder, changes))
} else {