* Streaming: Fix unused resend delay field in the packet header,

it is defined as seconds and we were not dividing by 1000,
      so we were truncating 1000 to one byte which equals 232.
This commit is contained in:
zzz
2009-11-09 17:21:17 +00:00
parent b4615edfcc
commit 37a2ccca95
3 changed files with 16 additions and 2 deletions

View File

@ -1105,7 +1105,8 @@ public class Connection {
if (choke > 0)
_packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
_packet.setOptionalMaxSize(getOptions().getMaxMessageSize());
_packet.setResendDelay(getOptions().getResendDelay());
// bugfix release 0.7.8, we weren't dividing by 1000
_packet.setResendDelay(getOptions().getResendDelay() / 1000);
if (_packet.getReceiveStreamId() <= 0)
_packet.setReceiveStreamId(_receiveStreamId);
if (_packet.getSendStreamId() <= 0)

View File

@ -170,7 +170,8 @@ class ConnectionDataReceiver implements MessageOutputStream.DataReceiver {
packet.setOptionalDelay(choke);
if (choke > 0)
packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
packet.setResendDelay(con.getOptions().getResendDelay());
// bugfix release 0.7.8, we weren't dividing by 1000
packet.setResendDelay(con.getOptions().getResendDelay() / 1000);
if (con.getOptions().getProfile() == ConnectionOptions.PROFILE_INTERACTIVE)
packet.setFlag(Packet.FLAG_PROFILE_INTERACTIVE, true);

View File

@ -216,9 +216,21 @@ public class Packet {
* resending this packet (if it hasn't yet been ACKed). The
* value is seconds since the packet was created.
*
* Unused.
* Broken before release 0.7.8
* Not to be used without sanitizing for huge values.
* Setters from options did not divide by 1000, and the options default
* is 1000, so the value sent in the 1-byte field was always
* 1000 & 0xff = 0xe8 = 232
*
* @return Delay before resending a packet in seconds.
*/
public int getResendDelay() { return _resendDelay; }
/**
* Unused.
* Broken before release 0.7.8
* See above
*/
public void setResendDelay(int numSeconds) { _resendDelay = numSeconds; }
public static final int MAX_PAYLOAD_SIZE = 32*1024;