commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwins...@apache.org
Subject svn commit: r630682 - /commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java
Date Sun, 24 Feb 2008 21:36:13 GMT
Author: rwinston
Date: Sun Feb 24 13:36:12 2008
New Revision: 630682

URL: http://svn.apache.org/viewvc?rev=630682&view=rev
Log:
NET-181

Modified:
    commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java

Modified: commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java?rev=630682&r1=630681&r2=630682&view=diff
==============================================================================
--- commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java (original)
+++ commons/proper/net/trunk/src/java/org/apache/commons/net/tftp/TFTPClient.java Sun Feb
24 13:36:12 2008
@@ -231,13 +231,19 @@
                                 throw e;
                             }
                             ++block;
+                            if (block > 65535)
+							{
+								// wrap the block number
+								block = 0;
+							}
+                            
                             break _receivePacket;
                         }
                         else
                         {
                             discardPackets();
 
-                            if (lastBlock == (block - 1))
+                            if (lastBlock == (block == 0 ? 65535 : (block - 1)))
                                 continue _sendPacket;  // Resend last acknowledgement.
 
                             continue _receivePacket; // Start fetching packets again.
@@ -464,6 +470,11 @@
                         if (lastBlock == block)
                         {
                             ++block;
+                            if (block > 65535)
+							{
+								// wrap the block number
+								block = 0;
+							}
                             if (lastAckWait) {
                                 
                               break _sendPacket;
@@ -476,7 +487,7 @@
                         {
                             discardPackets();
 
-                            if (lastBlock == (block - 1))
+                            if (lastBlock == (block == 0 ? 65535 : (block - 1)))
                                 continue _sendPacket;  // Resend last acknowledgement.
 
                             continue _receivePacket; // Start fetching packets again.



Mime
View raw message