mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 18:24:36 +00:00
drop peer_mgr in time (#2064)
This commit is contained in:
@@ -867,7 +867,9 @@ impl Instance {
|
|||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut output_tx = Some(first_round_output);
|
let mut output_tx = Some(first_round_output);
|
||||||
loop {
|
loop {
|
||||||
let Some(peer_manager) = peer_mgr.upgrade() else {
|
let close_notifier = Arc::new(Notify::new());
|
||||||
|
{
|
||||||
|
let Some(peer_mgr) = peer_mgr.upgrade() else {
|
||||||
tracing::warn!("peer manager is dropped, stop static ip check.");
|
tracing::warn!("peer manager is dropped, stop static ip check.");
|
||||||
if let Some(output_tx) = output_tx.take() {
|
if let Some(output_tx) = output_tx.take() {
|
||||||
let _ = output_tx.send(Err(Error::Unknown));
|
let _ = output_tx.send(Err(Error::Unknown));
|
||||||
@@ -876,10 +878,9 @@ impl Instance {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let close_notifier = Arc::new(Notify::new());
|
|
||||||
let mut new_nic_ctx = NicCtx::new(
|
let mut new_nic_ctx = NicCtx::new(
|
||||||
peer_manager.get_global_ctx(),
|
peer_mgr.get_global_ctx(),
|
||||||
&peer_manager,
|
&peer_mgr,
|
||||||
peer_packet_receiver.clone(),
|
peer_packet_receiver.clone(),
|
||||||
close_notifier.clone(),
|
close_notifier.clone(),
|
||||||
);
|
);
|
||||||
@@ -899,7 +900,7 @@ impl Instance {
|
|||||||
{
|
{
|
||||||
let ifname = new_nic_ctx.ifname().await;
|
let ifname = new_nic_ctx.ifname().await;
|
||||||
let dns_runner = if let Some(ipv4) = ipv4_addr {
|
let dns_runner = if let Some(ipv4) = ipv4_addr {
|
||||||
Self::create_magic_dns_runner(peer_manager, ifname, ipv4)
|
Self::create_magic_dns_runner(peer_mgr, ifname, ipv4)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
@@ -907,6 +908,7 @@ impl Instance {
|
|||||||
}
|
}
|
||||||
#[cfg(not(feature = "magic-dns"))]
|
#[cfg(not(feature = "magic-dns"))]
|
||||||
Self::use_new_nic_ctx(nic_ctx.clone(), new_nic_ctx).await;
|
Self::use_new_nic_ctx(nic_ctx.clone(), new_nic_ctx).await;
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(output_tx) = output_tx.take() {
|
if let Some(output_tx) = output_tx.take() {
|
||||||
let _ = output_tx.send(Ok(()));
|
let _ = output_tx.send(Ok(()));
|
||||||
|
|||||||
Reference in New Issue
Block a user