mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 03:43:33 +08:00
mavlink_ftp: do not store reply on kErrNoSessionsAvailable
This would interfere with an existing ongoing session
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user