force minimum for p_hrc time_point values

This commit is contained in:
Stephen Birarda 2015-09-14 17:13:43 -07:00
parent 2385331075
commit 84ab4fd585
5 changed files with 11 additions and 10 deletions

View file

@ -108,7 +108,8 @@ public:
private:
void stopSlowStart(); // stops the slow start on loss or timeout
p_high_resolution_clock::time_point _lastRCTime; // last rate increase time
p_high_resolution_clock::time_point _lastRCTime = p_high_resolution_clock::time_point().min(); // last rate increase time
bool _slowStart { true }; // if in slow start phase
SequenceNumber _slowStartLastAck; // last ACKed seq num
bool _loss { false }; // if loss happened since last rate increase

View file

@ -222,7 +222,7 @@ void Connection::recordRetransmission() {
}
void Connection::sendACK(bool wasCausedBySyncTimeout) {
static p_high_resolution_clock::time_point lastACKSendTime;
static p_high_resolution_clock::time_point lastACKSendTime = p_high_resolution_clock::time_point().min();
auto currentTime = p_high_resolution_clock::now();
SequenceNumber nextACKNumber = nextACK();
@ -534,7 +534,7 @@ void Connection::processACK(std::unique_ptr<ControlPacket> controlPacket) {
// This will be the case if it has been longer than the sync interval OR
// it looks like they haven't received our ACK2 for this ACK
auto currentTime = p_high_resolution_clock::now();
static p_high_resolution_clock::time_point lastACK2SendTime;
static p_high_resolution_clock::time_point lastACK2SendTime = p_high_resolution_clock::time_point().min();
microseconds sinceLastACK2 = duration_cast<microseconds>(currentTime - lastACK2SendTime);
@ -779,7 +779,7 @@ void Connection::resetReceiveState() {
// clear the loss list and _lastNAKTime
_lossList.clear();
_lastNAKTime = p_high_resolution_clock::time_point();
_lastNAKTime = p_high_resolution_clock::time_point().min();
// the _nakInterval need not be reset, that will happen on loss

View file

@ -114,13 +114,13 @@ private:
int _nakInterval { -1 }; // NAK timeout interval, in microseconds, set on loss
int _minNAKInterval { 100000 }; // NAK timeout interval lower bound, default of 100ms
p_high_resolution_clock::time_point _lastNAKTime;
p_high_resolution_clock::time_point _lastNAKTime = p_high_resolution_clock::time_point().min();
bool _hasReceivedHandshake { false }; // flag for receipt of handshake from server
bool _hasReceivedHandshakeACK { false }; // flag for receipt of handshake ACK from client
p_high_resolution_clock::time_point _connectionStart; // holds the time_point for creation of this connection
p_high_resolution_clock::time_point _lastReceiveTime; // holds the last time we received anything from sender
p_high_resolution_clock::time_point _connectionStart = p_high_resolution_clock::time_point().min(); // holds the time_point for creation of this connection
p_high_resolution_clock::time_point _lastReceiveTime = p_high_resolution_clock::time_point().min(); // holds the last time we received anything from sender
bool _isReceivingData { false }; // flag used for expiry of receipt portion of connection
LossList _lossList; // List of all missing packets

View file

@ -42,8 +42,8 @@ private:
std::vector<int> _packetIntervals; // vector of microsecond intervals between packet arrivals
std::vector<int> _probeIntervals; // vector of microsecond intervals between probe pair arrivals
p_high_resolution_clock::time_point _lastPacketTime; // the time_point when last packet arrived
p_high_resolution_clock::time_point _firstProbeTime; // the time_point when first probe in pair arrived
p_high_resolution_clock::time_point _lastPacketTime = p_high_resolution_clock::time_point().min(); // the time_point when last packet arrived
p_high_resolution_clock::time_point _firstProbeTime = p_high_resolution_clock::time_point().min(); // the time_point when first probe in pair arrived
};
}

View file

@ -281,7 +281,7 @@ void SendQueue::run() {
// if it has been at least 100ms since we last sent a handshake, send another now
// hold the time of last send in a static
static auto lastSendHandshake = p_high_resolution_clock::time_point();
static auto lastSendHandshake = p_high_resolution_clock::time_point().min();
static const auto HANDSHAKE_RESEND_INTERVAL_MS = std::chrono::milliseconds(100);