added explicit conversions
This commit is contained in:
parent
8cab24104c
commit
5082438d6e
1 changed files with 4 additions and 5 deletions
|
@ -47,13 +47,13 @@ pub async fn connect_to_server(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok((mut ws, _)) => {
|
Ok((mut ws, _)) => {
|
||||||
|
debug!("Connection successful");
|
||||||
let (to_core_sender, to_core_reciever) = async_channel::bounded::<ApplicationMessage>(MAX_MESSAGE);
|
let (to_core_sender, to_core_reciever) = async_channel::bounded::<ApplicationMessage>(MAX_MESSAGE);
|
||||||
let (to_app_events, from_app_events) = async_channel::bounded::<ApplicationMessage>(MAX_MESSAGE);
|
let (to_app_events, from_app_events) = async_channel::bounded::<ApplicationMessage>(MAX_MESSAGE);
|
||||||
|
|
||||||
let res: AppSender = to_core_sender; // to core: endpoint -> remote
|
debug!("created channels for oneshote");
|
||||||
let rec: AppReceiver = from_app_events; // from app: remote -> endpoint
|
|
||||||
|
|
||||||
if let Err(e) = result_oneshot.send(Ok((res.clone(), rec))) {
|
if let Err(e) = result_oneshot.send(Ok((to_core_sender as AppSender, from_app_events as AppReceiver))) {
|
||||||
if let Err(e2) = ws.close(None).await {
|
if let Err(e2) = ws.close(None).await {
|
||||||
error!("Could not close connection to websocket! {e2}");
|
error!("Could not close connection to websocket! {e2}");
|
||||||
}
|
}
|
||||||
|
@ -63,12 +63,11 @@ pub async fn connect_to_server(
|
||||||
|
|
||||||
let (ws_sender, ws_recv) = ws.split();
|
let (ws_sender, ws_recv) = ws.split();
|
||||||
|
|
||||||
let to_app: AppSender = to_app_events;
|
|
||||||
let receiver_is_closed = Arc::new(AtomicBool::new(false));
|
let receiver_is_closed = Arc::new(AtomicBool::new(false));
|
||||||
let moved_copy = receiver_is_closed.clone();
|
let moved_copy = receiver_is_closed.clone();
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
listen_to_ws_task(to_app, moved_copy, ws_recv)
|
listen_to_ws_task(to_app_events as AppSender, moved_copy, ws_recv)
|
||||||
});
|
});
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
|
|
Loading…
Reference in a new issue