2005-10-05 jrandom
* Allow the first few packets in the stream to fill in their IDs during handshake (thanks cervantes, Complication, et al!) This should fix at least some of the intermittent HTTP POST issues.
This commit is contained in:
@ -936,8 +936,10 @@ public class Connection {
|
||||
_packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
|
||||
_packet.setOptionalMaxSize(getOptions().getMaxMessageSize());
|
||||
_packet.setResendDelay(getOptions().getResendDelay());
|
||||
//_packet.setReceiveStreamId(_receiveStreamId);
|
||||
//_packet.setSendStreamId(_sendStreamId);
|
||||
if (_packet.getReceiveStreamId() <= 0)
|
||||
_packet.setReceiveStreamId(_receiveStreamId);
|
||||
if (_packet.getSendStreamId() <= 0)
|
||||
_packet.setSendStreamId(_sendStreamId);
|
||||
|
||||
int newWindowSize = getOptions().getWindowSize();
|
||||
|
||||
|
@ -152,7 +152,8 @@ public class Packet {
|
||||
/** what stream do we send data to the peer on? */
|
||||
public long getSendStreamId() { return _sendStreamId; }
|
||||
public void setSendStreamId(long id) {
|
||||
if (_sendStreamIdSet) throw new RuntimeException("Send stream ID already set [" + _sendStreamId + ", " + id + "]");
|
||||
if ( (_sendStreamIdSet) && (_sendStreamId > 0) )
|
||||
throw new RuntimeException("Send stream ID already set [" + _sendStreamId + ", " + id + "]");
|
||||
_sendStreamIdSet = true;
|
||||
_sendStreamId = id;
|
||||
}
|
||||
@ -164,7 +165,8 @@ public class Packet {
|
||||
*/
|
||||
public long getReceiveStreamId() { return _receiveStreamId; }
|
||||
public void setReceiveStreamId(long id) {
|
||||
if (_receiveStreamIdSet) throw new RuntimeException("Receive stream ID already set [" + _receiveStreamId + ", " + id + "]");
|
||||
if ( (_receiveStreamIdSet) && (_receiveStreamId > 0) )
|
||||
throw new RuntimeException("Receive stream ID already set [" + _receiveStreamId + ", " + id + "]");
|
||||
_receiveStreamIdSet = true;
|
||||
_receiveStreamId = id;
|
||||
}
|
||||
|
@ -161,7 +161,8 @@ public class PacketHandler {
|
||||
}
|
||||
} else {
|
||||
if ( (con.getSendStreamId() <= 0) ||
|
||||
(DataHelper.eq(con.getSendStreamId(), packet.getReceiveStreamId())) ) {
|
||||
(DataHelper.eq(con.getSendStreamId(), packet.getReceiveStreamId())) ||
|
||||
(packet.getSequenceNum() <= 5) ) { // its in flight from the first batch
|
||||
long oldId =con.getSendStreamId();
|
||||
if (packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) // con fully established, w00t
|
||||
con.setSendStreamId(packet.getReceiveStreamId());
|
||||
@ -229,7 +230,7 @@ public class PacketHandler {
|
||||
if (sendId <= 0) {
|
||||
Connection con = _manager.getConnectionByOutboundId(packet.getReceiveStreamId());
|
||||
if (con != null) {
|
||||
if (con.getAckedPackets() <= 0) {
|
||||
if ( (con.getHighestAckedThrough() <= 5) && (packet.getSequenceNum() <= 5) ) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Received additional packets before the syn on " + con + ": " + packet);
|
||||
receiveKnownCon(con, packet);
|
||||
|
Reference in New Issue
Block a user