Skip to content

Commit a82933a

Browse files
committed
调整运行时
1 parent 76444ef commit a82933a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

vnt/src/port_mapping/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,19 @@ pub fn start_port_mapping(
6666
if vec.is_empty() {
6767
return Ok(());
6868
}
69-
let runtime = tokio::runtime::Builder::new_multi_thread()
70-
.enable_all()
71-
.thread_name("portMapping")
72-
.build()?;
73-
runtime.block_on(start_port_mapping0(vec))?;
69+
7470
let (sender, receiver) = tokio::sync::oneshot::channel::<()>();
7571
let worker = stop_manager.add_listener("portMapping".into(), move || {
7672
let _ = sender.send(());
7773
})?;
7874
thread::Builder::new()
7975
.name("portMapping".into())
8076
.spawn(move || {
77+
let runtime = tokio::runtime::Builder::new_multi_thread()
78+
.enable_all()
79+
.thread_name("portMapping")
80+
.build().unwrap();
81+
runtime.block_on(start_port_mapping0(vec)).unwrap();
8182
runtime.block_on(async {
8283
let _ = receiver.await;
8384
});

0 commit comments

Comments
 (0)