fixed not awaiting async functions...
This commit is contained in:
parent
c65bce0a69
commit
0765f70fa7
1 changed files with 3 additions and 7 deletions
10
src/lib.rs
10
src/lib.rs
|
@ -32,7 +32,7 @@ pub type AppReceiver = Receiver<ApplicationMessage>;
|
|||
/// It will attempt to connect to the ws string, and will either
|
||||
/// return an `AppSender` or the websocket error.
|
||||
/// If the oneshot is unable to be sent to, it will trace and error and close down
|
||||
#[instrument(skip(result_oneshot))]
|
||||
#[instrument(skip(result_oneshot, rt))]
|
||||
pub async fn connect_to_server(
|
||||
connection_string: String,
|
||||
result_oneshot: oneshot::Sender<Result<(AppSender, AppReceiver), tungstenite_error>>,
|
||||
|
@ -69,13 +69,9 @@ pub async fn connect_to_server(
|
|||
let receiver_is_closed = Arc::new(AtomicBool::new(false));
|
||||
let moved_copy = receiver_is_closed.clone();
|
||||
|
||||
rt.spawn(async move {
|
||||
listen_to_ws_task(to_app_events as AppSender, moved_copy, ws_recv)
|
||||
});
|
||||
rt.spawn(listen_to_ws_task(to_app_events as AppSender, moved_copy, ws_recv));
|
||||
|
||||
rt.spawn(async move {
|
||||
send_to_wc_task(to_core_reciever, receiver_is_closed, ws_sender)
|
||||
});
|
||||
rt.spawn(send_to_wc_task(to_core_reciever, receiver_is_closed, ws_sender));
|
||||
|
||||
info!("Websocket connect successfully");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue