Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(*): correctly report is_connected when a socket is closed by remote #69

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

/// 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 Expand Up @@ -219,7 +221,7 @@
let peer_handle = *peer_handle;
match self.send_at(ClosePeerConnection { peer_handle }) {
Err(crate::error::Error::AT(atat::Error::InvalidResponse)) | Ok(_) => {
()

Check warning on line 224 in ublox-short-range/src/wifi/tcp_stack.rs

View workflow job for this annotation

GitHub Actions / clippy

unneeded unit expression

warning: unneeded unit expression --> ublox-short-range/src/wifi/tcp_stack.rs:224:33 | 224 | ... () | ^^ help: remove the final `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit = note: `#[warn(clippy::unused_unit)]` on by default
}
Err(_) => return Err(Error::Unaddressable),
}
Expand Down
Loading