fix ring buffer stuck when using multi thread runtime

This commit is contained in:
sijie.sun
2024-09-26 00:18:17 +08:00
committed by Sijie.Sun
parent 3f9a1d8f2e
commit 7b4a01e7fb
9 changed files with 119 additions and 150 deletions

View File

@@ -522,7 +522,7 @@ mod tests {
tests::{connect_peer_manager, wait_route_appear},
},
proto::common::NatType,
tunnel::common::tests::{enable_log, wait_for_condition},
tunnel::common::tests::wait_for_condition,
};
use super::*;

View File

@@ -25,6 +25,7 @@ use zerocopy::AsBytes;
use crate::{
common::{
config::{NetworkIdentity, NetworkSecretDigest},
defer,
error::Error,
global_ctx::ArcGlobalCtx,
PeerId,
@@ -103,7 +104,9 @@ impl PeerConn {
my_peer_id,
global_ctx,
tunnel: Arc::new(Mutex::new(Box::new(mpsc_tunnel))),
tunnel: Arc::new(Mutex::new(Box::new(defer::Defer::new(move || {
mpsc_tunnel.close()
})))),
sink,
recv: Arc::new(Mutex::new(Some(recv))),
tunnel_info,