diff options
author | Kinsey Moore <kinsey.moore@oarcorp.com> | 2021-05-17 13:24:48 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2021-05-18 13:58:34 -0500 |
commit | a918844889eb603622bb78f81139a5e20a71ab6b (patch) | |
tree | f116ecf8ca5ae745e0d36d3e579ee14720cd6be8 | |
parent | rtemstoolkit/mailer.py: Fix option ordering for add_arguments (diff) | |
download | rtems-tools-a918844889eb603622bb78f81139a5e20a71ab6b.tar.bz2 |
tester: Avoid TFTP race condition
The u-boot TFTP client will fail a fully completed file retrieval if the
final ACK gets an ICMP response that the port is unavailable which can
occur if the port is closed before the ACK arrives from the client. This
change causes the TFTP server to wait for the final ACK before closing
the socket and prevents transfers from failing due to the race
condition.
-rw-r--r-- | tester/rt/tftpserver.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tester/rt/tftpserver.py b/tester/rt/tftpserver.py index d733301..46b594f 100644 --- a/tester/rt/tftpserver.py +++ b/tester/rt/tftpserver.py @@ -418,8 +418,6 @@ class udp_handler(socketserver.BaseRequestHandler): ' < ' + session.decode(client_ip, client_port, response)) sock.sendto(response, (client_ip, client_port)) - if session.finished: - break try: data, address = sock.recvfrom(2 + 2 + session.get_block_size()) @@ -438,6 +436,8 @@ class udp_handler(socketserver.BaseRequestHandler): log.trace('] tftp: %d: receive: %s: error: %s' \ % (index, client, serr)) return + if session.finished: + break response = session.process(address[0], address[1], data) except error.general as gerr: self._notice('] tftp: %dd: error: %s' % (index, gerr)) |