Skip to content

Commit

Permalink
mavlink_ftp: do not store reply on kErrNoSessionsAvailable
Browse files Browse the repository at this point in the history
This would interfere with an existing ongoing session
  • Loading branch information
bkueng committed May 7, 2024
1 parent f002b08 commit e17faec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/mavlink/mavlink_ftp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ MavlinkFTP::_reply(mavlink_file_transfer_protocol_t *ftp_req)
// we can simply resend the response.
// we only keep small responses to reduce RAM usage and avoid large memcpy's. The larger responses are all data
// retrievals without side-effects, meaning it's ok to reexecute them if a response gets lost
if (payload->size <= sizeof(uint32_t)) {
if (payload->size <= sizeof(uint32_t) && payload->data[0] != kErrNoSessionsAvailable) {
_last_reply_valid = true;
memcpy(_last_reply, ftp_req, sizeof(_last_reply));
}
Expand Down Expand Up @@ -514,7 +514,7 @@ MavlinkFTP::ErrorCode
MavlinkFTP::_workOpen(PayloadHeader *payload, int oflag)
{
if (_session_info.fd >= 0) {
PX4_ERR("FTP: Open failed - out of sessions\n");
PX4_ERR("FTP: Open failed - out of sessions");
return kErrNoSessionsAvailable;
}

Expand Down

0 comments on commit e17faec

Please sign in to comment.