use local-channel instead of tokio sync channel (#179)

this avoids the mutex overhead in tokio
This commit is contained in:
Ferdinand Schober
2024-08-12 18:20:21 +02:00
committed by GitHub
parent 19c2c4327f
commit e7a1d72149
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");
}
}