Author: sebb Date: Thu Feb 9 17:43:30 2017 New Revision: 1782372 URL: http://svn.apache.org/viewvc?rev=1782372&view=rev Log: NET-613 TFTPClient assumes that lastBlock == 0 only once
Modified: commons/proper/net/trunk/src/changes/changes.xml commons/proper/net/trunk/src/main/java/org/apache/commons/net/tftp/TFTPClient.java Modified: commons/proper/net/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1782372&r1=1782371&r2=1782372&view=diff ============================================================================== --- commons/proper/net/trunk/src/changes/changes.xml [utf-8] (original) +++ commons/proper/net/trunk/src/changes/changes.xml [utf-8] Thu Feb 9 17:43:30 2017 @@ -87,6 +87,9 @@ without checking it if is a space. The POP3Mail examples can now get password from console, stdin or an environment variable. "> + <action issue="NET-613" type="fix" dev="sebb"> + TFTPClient assumes that lastBlock == 0 only once + </action> <action issue="NET-320" type="fix" dev="sebb" due-to="Kevin Bulebush"> Allow TFTPServer.java to bind to a specific network adapter </action> Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/tftp/TFTPClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/tftp/TFTPClient.java?rev=1782372&r1=1782371&r2=1782372&view=diff ============================================================================== --- commons/proper/net/trunk/src/main/java/org/apache/commons/net/tftp/TFTPClient.java (original) +++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/tftp/TFTPClient.java Thu Feb 9 17:43:30 2017 @@ -163,6 +163,7 @@ public class TFTPClient extends TFTP beginBufferedOps(); + boolean justStarted = true; try { do { // while more data to fetch bufferedSend(sent); // start the fetch/send an ack @@ -175,8 +176,8 @@ public class TFTPClient extends TFTP // answering host address (for hosts with multiple IPs) final int recdPort = received.getPort(); final InetAddress recdAddress = received.getAddress(); - if (lastBlock == 0) - { + if (justStarted) { + justStarted = false; if (recdPort == port) { // must not use the control port here TFTPErrorPacket error = new TFTPErrorPacket(recdAddress, recdPort, TFTPErrorPacket.UNKNOWN_TID,