Disable packet probes

This commit is contained in:
Atlante45 2016-09-27 13:54:24 -07:00 committed by Stephen Birarda
parent 202641a349
commit 2c026d7b0f
6 changed files with 13 additions and 3 deletions

View file

@ -46,6 +46,7 @@ public:
virtual bool shouldNAK() { return true; }
virtual bool shouldACK2() { return true; }
virtual bool shouldProbe() { return true; }
virtual void onPacketSent(int packetSize, SequenceNumber seqNum, p_high_resolution_clock::time_point timePoint) {}
protected:

View file

@ -125,6 +125,7 @@ SendQueue& Connection::getSendQueue() {
_sendQueue->setSyncInterval(_synInterval);
_sendQueue->setEstimatedTimeout(estimatedTimeout());
_sendQueue->setFlowWindowSize(std::min(_flowWindowSize, (int) _congestionControl->_congestionWindowSize));
_sendQueue->setProbePacketEnabled(_congestionControl->shouldProbe());
// give the randomized sequence number to the congestion control object
_congestionControl->setInitialSendSequenceNumber(_sendQueue->getCurrentSequenceNumber());

View file

@ -396,6 +396,10 @@ void SendQueue::run() {
}
}
void SendQueue::setProbePacketEnabled(bool enabled) {
_shouldSendProbes = enabled;
}
int SendQueue::maybeSendNewPacket() {
if (!isFlowWindowFull()) {
// we didn't re-send a packet, so time to send a new one
@ -413,7 +417,7 @@ int SendQueue::maybeSendNewPacket() {
std::unique_ptr<Packet> secondPacket;
bool shouldSendPairTail = false;
if (((uint32_t) nextNumber & 0xF) == 0) {
if (_shouldSendProbes && ((uint32_t) nextNumber & 0xF) == 0) {
// the first packet is the first in a probe pair - every 16 (rightmost 16 bits = 0) packets
// pull off a second packet if we can before we unlock
shouldSendPairTail = true;

View file

@ -65,6 +65,8 @@ public:
void setEstimatedTimeout(int estimatedTimeout) { _estimatedTimeout = estimatedTimeout; }
void setSyncInterval(int syncInterval) { _syncInterval = syncInterval; }
void setProbePacketEnabled(bool enabled);
public slots:
void stop();
@ -140,6 +142,9 @@ private:
std::condition_variable _handshakeACKCondition;
std::condition_variable_any _emptyCondition;
std::atomic<bool> _shouldSendProbes { true };
};
}

View file

@ -52,8 +52,6 @@ bool TCPVegasCC::onACK(SequenceNumber ack, p_high_resolution_clock::time_point r
+ abs(lastRTT - _ewmaRTT)) / RTT_ESTIMATION_VARIANCE_ALPHA_NUMERATOR;
}
// keep track of the lowest RTT during connection
_baseRTT = std::min(_baseRTT, lastRTT);

View file

@ -33,6 +33,7 @@ public:
virtual bool shouldNAK() override { return false; }
virtual bool shouldACK2() override { return false; }
virtual bool shouldProbe() override { return false; }
virtual void onPacketSent(int packetSize, SequenceNumber seqNum, p_high_resolution_clock::time_point timePoint) override;