mavlink_ftp: do not store reply on kErrNoSessionsAvailable

This would interfere with an existing ongoing session
This commit is contained in:
Beat Küng
2024-05-07 07:26:12 +02:00
parent f002b08e6a
commit e17faece3d
+2 -2
View File
@@ -326,7 +326,7 @@ MavlinkFTP::_reply(mavlink_file_transfer_protocol_t *ftp_req)
// we can simply resend the response. // 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 // 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 // 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; _last_reply_valid = true;
memcpy(_last_reply, ftp_req, sizeof(_last_reply)); memcpy(_last_reply, ftp_req, sizeof(_last_reply));
} }
@@ -514,7 +514,7 @@ MavlinkFTP::ErrorCode
MavlinkFTP::_workOpen(PayloadHeader *payload, int oflag) MavlinkFTP::_workOpen(PayloadHeader *payload, int oflag)
{ {
if (_session_info.fd >= 0) { if (_session_info.fd >= 0) {
PX4_ERR("FTP: Open failed - out of sessions\n"); PX4_ERR("FTP: Open failed - out of sessions");
return kErrNoSessionsAvailable; return kErrNoSessionsAvailable;
} }