update last_updated of peer info to local now (#211)
Some checks are pending
EasyTier Core / pre_job (push) Waiting to run
EasyTier Core / build (macos-latest, aarch64-apple-darwin) (push) Blocked by required conditions
EasyTier Core / build (macos-latest, x86_64-apple-darwin) (push) Blocked by required conditions
EasyTier Core / build (ubuntu-latest, aarch64-unknown-linux-musl) (push) Blocked by required conditions
EasyTier Core / build (ubuntu-latest, arm-unknown-linux-musleabi) (push) Blocked by required conditions
EasyTier Core / build (ubuntu-latest, arm-unknown-linux-musleabihf) (push) Blocked by required conditions
EasyTier Core / build (ubuntu-latest, armv7-unknown-linux-musleabi) (push) Blocked by required conditions
EasyTier Core / build (ubuntu-latest, armv7-unknown-linux-musleabihf) (push) Blocked by required conditions
EasyTier Core / build (ubuntu-latest, mips-unknown-linux-musl) (push) Blocked by required conditions
EasyTier Core / build (ubuntu-latest, mipsel-unknown-linux-musl) (push) Blocked by required conditions
EasyTier Core / build (ubuntu-latest, x86_64-unknown-linux-musl) (push) Blocked by required conditions
EasyTier Core / build (windows-latest, x86_64-pc-windows-msvc) (push) Blocked by required conditions
EasyTier Core / core-result (push) Blocked by required conditions
EasyTier GUI / pre_job (push) Waiting to run
EasyTier GUI / build-gui (aarch64-apple-darwin, macos-latest, aarch64-apple-darwin) (push) Blocked by required conditions
EasyTier GUI / build-gui (aarch64-unknown-linux-gnu, ubuntu-latest, aarch64-unknown-linux-musl) (push) Blocked by required conditions
EasyTier GUI / build-gui (x86_64-apple-darwin, macos-latest, x86_64-apple-darwin) (push) Blocked by required conditions
EasyTier GUI / build-gui (x86_64-pc-windows-msvc, windows-latest, x86_64-pc-windows-msvc) (push) Blocked by required conditions
EasyTier GUI / build-gui (x86_64-unknown-linux-gnu, ubuntu-latest, x86_64-unknown-linux-musl) (push) Blocked by required conditions
EasyTier GUI / gui-result (push) Blocked by required conditions
EasyTier Mobile / pre_job (push) Waiting to run
EasyTier Mobile / build-mobile (ubuntu-latest, android) (push) Blocked by required conditions
EasyTier Mobile / mobile-result (push) Blocked by required conditions
EasyTier Test / pre_job (push) Waiting to run
EasyTier Test / test (push) Blocked by required conditions

time between peers may not be synced, using peer last_updated time may cause peer info being cleared incorrectly
This commit is contained in:
Sijie.Sun 2024-08-02 00:48:31 +08:00 committed by GitHub
parent 7a2bc52ae0
commit 4fea3a60d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

11
Cargo.lock generated
View File

@ -1426,6 +1426,7 @@ dependencies = [
"url",
"uuid",
"windows-sys 0.52.0",
"winreg 0.11.0",
"zerocopy",
"zip",
]
@ -7175,6 +7176,16 @@ dependencies = [
"winapi",
]
[[package]]
name = "winreg"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76a1a57ff50e9b408431e8f97d5456f2807f8eb2a2cd79b06068fc87f8ecf189"
dependencies = [
"cfg-if",
"winapi",
]
[[package]]
name = "winreg"
version = "0.50.0"

View File

@ -291,7 +291,11 @@ impl SyncedRouteInfo {
peer_infos: &Vec<RoutePeerInfo>,
) -> Result<(), Error> {
self.check_duplicate_peer_id(my_peer_id, dst_peer_id, peer_infos)?;
for route_info in peer_infos.iter() {
for mut route_info in peer_infos.iter().map(Clone::clone) {
// time between peers may not be synchronized, so update last_update to local now.
// note only last_update with larger version will be updated to local saved peer info.
route_info.last_update = SystemTime::now();
self.peer_infos
.entry(route_info.peer_id)
.and_modify(|old_entry| {