use local-channel instead of tokio sync channel

this avoids the mutex overhead in tokio
This commit is contained in:
Ferdinand Schober
2024-08-12 18:02:41 +02:00
parent 19c2c4327f
commit 6c0dda8f37
8 changed files with 54 additions and 61 deletions

View File

@@ -1,11 +1,8 @@
use local_channel::mpsc::{Receiver, Sender};
use std::{io, net::SocketAddr};
use thiserror::Error;
use tokio::{
net::UdpSocket,
sync::mpsc::{Receiver, Sender},
task::JoinHandle,
};
use tokio::{net::UdpSocket, task::JoinHandle};
use super::Server;
use lan_mouse_proto::{ProtoEvent, ProtocolError};
@@ -65,7 +62,7 @@ async fn udp_receiver(
) {
loop {
let event = receive_event(socket).await;
receiver_tx.send(event).await.expect("channel closed");
receiver_tx.send(event).expect("channel closed");
}
}