You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rw...@apache.org on 2008/02/24 22:35:59 UTC
svn commit: r630681 -
/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPClient.java
Author: rwinston
Date: Sun Feb 24 13:35:58 2008
New Revision: 630681
URL: http://svn.apache.org/viewvc?rev=630681&view=rev
Log:
Block wrapping issue (NET-181)
Modified:
commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPClient.java
Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPClient.java?rev=630681&r1=630680&r2=630681&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPClient.java (original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/tftp/TFTPClient.java Sun Feb 24 13:35:58 2008
@@ -233,13 +233,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.
@@ -466,6 +472,11 @@
if (lastBlock == block)
{
++block;
+ if (block > 65535)
+ {
+ // wrap the block number
+ block = 0;
+ }
if (lastAckWait) {
break _sendPacket;
@@ -478,7 +489,7 @@
{
discardPackets();
- if (lastBlock == (block - 1))
+ if (lastBlock == (block == 0 ? 65535 : (block - 1)))
continue _sendPacket; // Resend last acknowledgement.
continue _receivePacket; // Start fetching packets again.