mirror of
https://github.com/lbl8603/vnt.git
synced 2025-09-26 20:21:20 +08:00
调整运行时
This commit is contained in:
@@ -66,11 +66,7 @@ pub fn start_port_mapping(
|
||||
if vec.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
let runtime = tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.thread_name("portMapping")
|
||||
.build()?;
|
||||
runtime.block_on(start_port_mapping0(vec))?;
|
||||
|
||||
let (sender, receiver) = tokio::sync::oneshot::channel::<()>();
|
||||
let worker = stop_manager.add_listener("portMapping".into(), move || {
|
||||
let _ = sender.send(());
|
||||
@@ -78,6 +74,11 @@ pub fn start_port_mapping(
|
||||
thread::Builder::new()
|
||||
.name("portMapping".into())
|
||||
.spawn(move || {
|
||||
let runtime = tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.thread_name("portMapping")
|
||||
.build().unwrap();
|
||||
runtime.block_on(start_port_mapping0(vec)).unwrap();
|
||||
runtime.block_on(async {
|
||||
let _ = receiver.await;
|
||||
});
|
||||
|
Reference in New Issue
Block a user