-
Notifications
You must be signed in to change notification settings - Fork 56
Fix MAVFTP file transfers on slow telemetry links #1334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -691,7 +691,8 @@ def __handle_burst_read(self, op, _m) -> MAVFTPReturn: # noqa PRL0911, PGH004, | |
| if self.ftp_settings.debug > 0: | ||
| logging.info("FTP: burst continue at %u %u", more.offset, self.fh.tell()) | ||
| self.__send(more) | ||
| elif op.opcode == OP_Nack: | ||
| return MAVFTPReturn("BurstReadFile", ERR_None) | ||
| if op.opcode == OP_Nack: | ||
| ecode = op.payload[0] | ||
| if ecode in {ERR_EndOfFile, 0}: | ||
| if not self.reached_eof and op.offset > self.fh.tell(): | ||
|
|
@@ -707,12 +708,8 @@ def __handle_burst_read(self, op, _m) -> MAVFTPReturn: # noqa PRL0911, PGH004, | |
| if self.__check_read_finished(): | ||
| return MAVFTPReturn("BurstReadFile", ERR_None) | ||
| self.__check_read_send() | ||
| elif self.ftp_settings.debug > 0: | ||
| logging.info("FTP: burst Nack (ecode:%u): %s", ecode, op) | ||
| return MAVFTPReturn("BurstReadFile", ERR_Fail) | ||
| if self.ftp_settings.debug > 0: | ||
| logging.error("FTP: burst nack: %s", op) | ||
| return MAVFTPReturn("BurstReadFile", ERR_Fail) | ||
| logging.info("FTP: burst Nack (ecode:%u): %s", ecode, op) | ||
|
Comment on lines
711
to
+712
|
||
| else: | ||
| logging.warning("FTP: burst error: %s", op) | ||
| return MAVFTPReturn("BurstReadFile", ERR_Fail) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing from
eliftoifcreates a logic error. The code now returns success (line 694) when handling OP_Ack, but then immediately continues to check ifop.opcode == OP_Nack(line 695). Since the function has already returned, the Nack check becomes unreachable code. The originalelifstructure was correct - after handling OP_Ack, the function should not check for OP_Nack on the same operation.