mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 04:21:35 +08:00
mavlink FTP: Speed up transfers by longer bursts
This commit is contained in:
@@ -491,6 +491,7 @@ MavlinkFTP::_workBurst(PayloadHeader* payload, uint8_t target_system_id)
|
|||||||
// Setup for streaming sends
|
// Setup for streaming sends
|
||||||
_session_info.stream_download = true;
|
_session_info.stream_download = true;
|
||||||
_session_info.stream_offset = payload->offset;
|
_session_info.stream_offset = payload->offset;
|
||||||
|
_session_info.stream_chunk_transmitted = 0;
|
||||||
_session_info.stream_seq_number = payload->seq_number + 1;
|
_session_info.stream_seq_number = payload->seq_number + 1;
|
||||||
_session_info.stream_target_system_id = target_system_id;
|
_session_info.stream_target_system_id = target_system_id;
|
||||||
|
|
||||||
@@ -872,6 +873,7 @@ void MavlinkFTP::send(const hrt_abstime t)
|
|||||||
} else {
|
} else {
|
||||||
payload->size = bytes_read;
|
payload->size = bytes_read;
|
||||||
_session_info.stream_offset += bytes_read;
|
_session_info.stream_offset += bytes_read;
|
||||||
|
_session_info.stream_chunk_transmitted += bytes_read;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -890,8 +892,12 @@ void MavlinkFTP::send(const hrt_abstime t)
|
|||||||
#ifndef MAVLINK_FTP_UNIT_TEST
|
#ifndef MAVLINK_FTP_UNIT_TEST
|
||||||
if (max_bytes_to_send < (get_size()*2)) {
|
if (max_bytes_to_send < (get_size()*2)) {
|
||||||
more_data = false;
|
more_data = false;
|
||||||
payload->burst_complete = true;
|
/* perform transfers in 35K chunks - this is determined empirical */
|
||||||
_session_info.stream_download = false;
|
if (_session_info.stream_chunk_transmitted > 35000) {
|
||||||
|
payload->burst_complete = true;
|
||||||
|
_session_info.stream_download = false;
|
||||||
|
_session_info.stream_chunk_transmitted = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
more_data = true;
|
more_data = true;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2014, 2015 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -165,6 +165,7 @@ private:
|
|||||||
uint32_t stream_offset;
|
uint32_t stream_offset;
|
||||||
uint16_t stream_seq_number;
|
uint16_t stream_seq_number;
|
||||||
uint8_t stream_target_system_id;
|
uint8_t stream_target_system_id;
|
||||||
|
unsigned stream_chunk_transmitted;
|
||||||
};
|
};
|
||||||
struct SessionInfo _session_info; ///< Session info, fd=-1 for no active session
|
struct SessionInfo _session_info; ///< Session info, fd=-1 for no active session
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user