mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:28:53 +08:00
mavlink_main: do not use message_buffer if _ftp_on
if _ftp_on is true, message_buffer was created and read, but it was actually never written to, so this is not needed. It can only ever be written to if _forwarding_on is true.
This commit is contained in:
@@ -1971,8 +1971,8 @@ Mavlink::task_main(int argc, char *argv[])
|
|||||||
pthread_mutex_init(&_send_mutex, nullptr);
|
pthread_mutex_init(&_send_mutex, nullptr);
|
||||||
|
|
||||||
/* if we are passing on mavlink messages, we need to prepare a buffer for this instance */
|
/* if we are passing on mavlink messages, we need to prepare a buffer for this instance */
|
||||||
if (_forwarding_on || _ftp_on) {
|
if (_forwarding_on) {
|
||||||
/* initialize message buffer if multiplexing is on or its needed for FTP.
|
/* initialize message buffer if multiplexing is on.
|
||||||
* make space for two messages plus off-by-one space as we use the empty element
|
* make space for two messages plus off-by-one space as we use the empty element
|
||||||
* marker ring buffer approach.
|
* marker ring buffer approach.
|
||||||
*/
|
*/
|
||||||
@@ -2301,8 +2301,8 @@ Mavlink::task_main(int argc, char *argv[])
|
|||||||
stream->update(t);
|
stream->update(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pass messages from other UARTs or FTP worker */
|
/* pass messages from other UARTs */
|
||||||
if (_forwarding_on || _ftp_on) {
|
if (_forwarding_on) {
|
||||||
|
|
||||||
bool is_part;
|
bool is_part;
|
||||||
uint8_t *read_ptr;
|
uint8_t *read_ptr;
|
||||||
@@ -2410,7 +2410,7 @@ Mavlink::task_main(int argc, char *argv[])
|
|||||||
_socket_fd = -1;
|
_socket_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_forwarding_on || _ftp_on) {
|
if (_forwarding_on) {
|
||||||
message_buffer_destroy();
|
message_buffer_destroy();
|
||||||
pthread_mutex_destroy(&_message_buffer_mutex);
|
pthread_mutex_destroy(&_message_buffer_mutex);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user