mirror of
https://github.com/EasyTier/EasyTier.git
synced 2024-11-16 11:42:27 +08:00
ensure dst have session when we are initiator (#398)
* ensure dst have session when we are initiator * bump version to 2.0.1
This commit is contained in:
parent
a08a8e7f4c
commit
1be64223c8
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -21,7 +21,7 @@ on:
|
|||
version:
|
||||
description: 'Version for this release'
|
||||
type: string
|
||||
default: 'v2.0.0'
|
||||
default: 'v2.0.1'
|
||||
required: true
|
||||
make_latest:
|
||||
description: 'Mark this release as latest'
|
||||
|
|
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1539,7 +1539,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
|||
|
||||
[[package]]
|
||||
name = "easytier"
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"anyhow",
|
||||
|
@ -1631,7 +1631,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "easytier-gui"
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "easytier-gui",
|
||||
"type": "module",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "easytier-gui"
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
description = "EasyTier GUI"
|
||||
authors = ["you"]
|
||||
edition = "2021"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"createUpdaterArtifacts": false
|
||||
},
|
||||
"productName": "easytier-gui",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"identifier": "com.kkrainbow.easytier",
|
||||
"plugins": {},
|
||||
"app": {
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "easytier"
|
|||
description = "A full meshed p2p VPN, connecting all your devices in one network with one command."
|
||||
homepage = "https://github.com/EasyTier/EasyTier"
|
||||
repository = "https://github.com/EasyTier/EasyTier"
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
edition = "2021"
|
||||
authors = ["kkrainbow"]
|
||||
keywords = ["vpn", "p2p", "network", "easytier"]
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::{
|
|||
atomic::{AtomicBool, AtomicU32, Ordering},
|
||||
Arc, Weak,
|
||||
},
|
||||
time::{Duration, SystemTime},
|
||||
time::{Duration, Instant, SystemTime},
|
||||
};
|
||||
|
||||
use crossbeam::atomic::AtomicCell;
|
||||
|
@ -1290,6 +1290,7 @@ impl PeerRouteServiceImpl {
|
|||
&self,
|
||||
dst_peer_id: PeerId,
|
||||
peer_rpc: Arc<PeerRpcManager>,
|
||||
sync_as_initiator: bool,
|
||||
) -> bool {
|
||||
let Some(session) = self.get_session(dst_peer_id) else {
|
||||
// if session not exist, exit the sync loop.
|
||||
|
@ -1306,6 +1307,7 @@ impl PeerRouteServiceImpl {
|
|||
&& conn_bitmap.is_none()
|
||||
&& foreign_network.is_none()
|
||||
&& !session.need_sync_initiator_info.load(Ordering::Relaxed)
|
||||
&& !(sync_as_initiator && session.we_are_initiator.load(Ordering::Relaxed))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1462,6 +1464,7 @@ impl RouteSessionManager {
|
|||
dst_peer_id: PeerId,
|
||||
mut sync_now: tokio::sync::broadcast::Receiver<()>,
|
||||
) {
|
||||
let mut last_sync = Instant::now();
|
||||
loop {
|
||||
let mut first_time = true;
|
||||
|
||||
|
@ -1479,8 +1482,16 @@ impl RouteSessionManager {
|
|||
service_impl.update_my_infos().await;
|
||||
}
|
||||
|
||||
// if we are initiator, we should ensure the dst has the session.
|
||||
let sync_as_initiator = if last_sync.elapsed().as_secs() > 10 {
|
||||
last_sync = Instant::now();
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
if service_impl
|
||||
.sync_route_with_peer(dst_peer_id, peer_rpc.clone())
|
||||
.sync_route_with_peer(dst_peer_id, peer_rpc.clone(), sync_as_initiator)
|
||||
.await
|
||||
{
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user