Skip to content

Commit

Permalink
matter: Rename wrapper for UnconnectedUdpSocket to MatterCompatUdpSocket
Browse files Browse the repository at this point in the history
  • Loading branch information
maikerlab committed Apr 23, 2024
1 parent 093983d commit faaed06
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/matter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rs_matter::error::{Error, ErrorCode};
use rs_matter::transport::network::{UdpReceive, UdpSend};
use log::{debug, warn, error, Level, LevelFilter, Log, Record, SetLoggerError};

pub struct UdpSocketWrapper {
pub struct MatterCompatUdpSocket {
local_addr: SocketAddr,
socket: Mutex<UnconnectedUdpSocket>,
release_socket_notification: Notification,
Expand Down Expand Up @@ -46,7 +46,7 @@ pub fn init_logger(level: LevelFilter) -> Result<(), SetLoggerError> {
.map(|_| log::set_max_level(level))
}

impl UdpSocketWrapper {
impl MatterCompatUdpSocket {
pub fn new(local_addr: SocketAddr, socket: UnconnectedUdpSocket) -> Self {
Self {
local_addr,
Expand All @@ -57,7 +57,7 @@ impl UdpSocketWrapper {
}
}

impl UdpSend for &UdpSocketWrapper {
impl UdpSend for &MatterCompatUdpSocket {
async fn send_to(&mut self, data: &[u8], addr: SocketAddr) -> Result<(), Error> {
if addr.is_ipv4() {
// IPv4 not supported!
Expand All @@ -77,7 +77,7 @@ impl UdpSend for &UdpSocketWrapper {
}
}

impl UdpReceive for &UdpSocketWrapper {
impl UdpReceive for &MatterCompatUdpSocket {
async fn recv_from(&mut self, buffer: &mut [u8]) -> Result<(usize, SocketAddr), Error> {
loop {
let mut sock = self.socket.try_lock().expect("sender should have ensured that this mutex is free");
Expand Down

0 comments on commit faaed06

Please sign in to comment.