From 6a5aba6ae5560633b8064a07d1eb5efb9193e289 Mon Sep 17 00:00:00 2001 From: asxalex Date: Sun, 14 Jul 2024 20:12:29 +0800 Subject: [PATCH] changed the oneshot of tokio to mpsc of std --- src/bin/sdlan/main.rs | 4 ++-- src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/sdlan/main.rs b/src/bin/sdlan/main.rs index 2fb3345..de8a8c5 100644 --- a/src/bin/sdlan/main.rs +++ b/src/bin/sdlan/main.rs @@ -10,7 +10,7 @@ use tokio::sync::oneshot; async fn main() { let _guard = log::init_log(); - let (tx, rx) = oneshot::channel(); + let (tx, rx) = std::sync::mpsc::channel(); let _ = run_sdlan( CommandLine { sn: "39.98.184.67:1265".to_owned(), @@ -27,7 +27,7 @@ async fn main() { }, tx, ).await; - rx.await; + rx.recv(); let edge = get_edge(); edge.start("0".to_owned()).await; diff --git a/src/lib.rs b/src/lib.rs index 653eb0d..a13716b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,7 @@ use sdlan_sn_rs::{ pub async fn run_sdlan( args: CommandLine, - sender: tokio::sync::oneshot::Sender, + sender: std::sync::mpsc::Sender, // start_stop_sender: Sender, // start_stop_receiver: Receiver, ) -> Result<()> {