Skip to content

Commit 1d44f87

Browse files
src: mavlink: Don't try to restart connection on WouldBlock error kind.
1 parent 87ab726 commit 1d44f87

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/mavlink/mavlink_camera.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ fn heartbeat_loop(
325325
"Failed to send heartbeat as {:#?}:{:#?}. Reason: {error}",
326326
header.system_id, header.component_id
327327
);
328+
{
329+
let mavlink::error::MessageWriteError::Io(io_error) = &error;
330+
if io_error.kind() == std::io::ErrorKind::WouldBlock {
331+
continue;
332+
}
333+
}
328334
*atomic_thread_state.lock().unwrap() = ThreadState::RESTART;
329335
} else {
330336
debug!(
@@ -830,6 +836,11 @@ fn receive_message_loop(
830836
error!("Error receiving a message as {:#?}:{:#?}. Reason: {error:#?}. Camera: {information:#?}",
831837
our_header.system_id, our_header.component_id
832838
);
839+
if let mavlink::error::MessageReadError::Io(io_error) = &error {
840+
if io_error.kind() == std::io::ErrorKind::WouldBlock {
841+
continue;
842+
}
843+
}
833844
*atomic_thread_state.lock().unwrap() = ThreadState::RESTART;
834845
}
835846
}

0 commit comments

Comments
 (0)