Skip to content

Commit

Permalink
fix(*): correctly report is_connected when a socket is closed by remo…
Browse files Browse the repository at this point in the history
…te (#69)

* Correctly close mark as closed socket as closed

* Adjust DATA_PACKET_SIZE to 2304 based on max WIFI MTU size
  • Loading branch information
MathiasKoch authored Oct 18, 2023
1 parent 3b8f1a0 commit bab0e46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ublox-short-range/src/command/edm/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use serde::{Deserialize, Serialize};
)]
pub struct ChannelId(pub u8);

pub const DATA_PACKAGE_SIZE: usize = 4096;
pub const DATA_PACKAGE_SIZE: usize = 2304;
pub const STARTBYTE: u8 = 0xAA;
pub const ENDBYTE: u8 = 0x55;
pub const EDM_SIZE_FILTER: u8 = 0x0F;
Expand Down
4 changes: 3 additions & 1 deletion ublox-short-range/src/wifi/tcp_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ where

/// Check if this socket is still connected
fn is_connected(&mut self, socket: &Self::TcpSocket) -> Result<bool, Self::Error> {
self.connected_to_network().map_err(|_| Error::Illegal)?;
if self.connected_to_network().is_err() {
return Ok(false);
}
if let Some(ref mut sockets) = self.sockets {
let tcp = sockets.get::<TcpSocket<L>>(*socket)?;
Ok(tcp.is_connected())
Expand Down

0 comments on commit bab0e46

Please sign in to comment.