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