|
I can't see how the flag in this patch helps anything. As far as I can tell, all
the lines in the patch that could make use of this new flag have + in front of them. None of those lines set the flag to true, so the flag is always false and the code pretty much does what it did before. There is another delta in the patch that changes how bufferedSend is called. FWIW restoring the deleted call to bufferedSend corrected the symptoms I had.
I concur with your assessment Michael. I don't see what this patch does
other than break TFTPClient.sendFile. Even if lastAckWait were true, the method would go into an infinite loop at the end. I'm going to revert the change. If the original issue reporter believes there is a bug in sendFile, then It is true that sendFile doesn't wait for a final ack (probably because
it was thought at the time that we didn't want to hang if the final ack got lost). Therefore, a UDP packet may remain queued for delivery to user space, causing a problem on subsequent read operation on the same socket. However, a call to TFTP.discardPackets is the appropriate (although imperfect if the last ack is delayed) workaround until we get more information about the problem.
Daniel has reverted the fix.
Neither the 1.41 release version of TFTPClient.java, nor the current nightly build version (as of Sept 15 2006) is working, actually. This bug is still happening. I will attach a zip file (which I just mistakenly put into Bugzilla, sorry!) with some test code.
The nightly build version is definitely doing what the bug report stated: dropping the last ACK. When TFTPClient sends a file, it sends a data packet and waits for an ACK, but after the last data packet, it doesn't pick up the last ACK, and then when TFTPClient goes to send/receive another file from the same server, the first thing it gets is the last ACK from the previous send, and it reports an "unexpected packet received" and fails. The version from the 1.41 release doesn't work either – I can't recall exactly what is wrong with it, actually, but I tested it and it does not work. The version I will attach does work. It would probably be a good idea to use something like this in the next release. I'll also attach my test code: a TFTPClientApp and TFTPServerApp that can be run on two different computers to test the workings of the TFTPClient class. This zip file contains a fix for TFTPClient.java, as well as TFTP test code. TFTPClientApp and TFTPServerApp need to be run on two separate computers – see embedded doc for more information.
Patch for suggested fix to TFTPClient.java
I've applied your patch to TFTPClient on the 2.0 branch. Thanks Jennifer.
Why hasn't this patch been applied to 1.4? What good does it do fixing in in 2.0, if that never gets built?
The 1.4 release, currently available for download is quite simply, broken. Files smaller than 1 block size simply aren't transferred, larger files are corrupted. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The patch as a file