diff --git a/libraries/networking/src/udt/CongestionControl.h b/libraries/networking/src/udt/CongestionControl.h index adbf1f0e85..5f9b64c1ad 100644 --- a/libraries/networking/src/udt/CongestionControl.h +++ b/libraries/networking/src/udt/CongestionControl.h @@ -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 diff --git a/libraries/networking/src/udt/Connection.cpp b/libraries/networking/src/udt/Connection.cpp index 21dce2831c..4aa785fa8c 100644 --- a/libraries/networking/src/udt/Connection.cpp +++ b/libraries/networking/src/udt/Connection.cpp @@ -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) { // 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(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 diff --git a/libraries/networking/src/udt/Connection.h b/libraries/networking/src/udt/Connection.h index 31ef664ce5..346f559165 100644 --- a/libraries/networking/src/udt/Connection.h +++ b/libraries/networking/src/udt/Connection.h @@ -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 diff --git a/libraries/networking/src/udt/PacketTimeWindow.h b/libraries/networking/src/udt/PacketTimeWindow.h index c2a90d0f6c..6030e6809f 100644 --- a/libraries/networking/src/udt/PacketTimeWindow.h +++ b/libraries/networking/src/udt/PacketTimeWindow.h @@ -42,8 +42,8 @@ private: std::vector _packetIntervals; // vector of microsecond intervals between packet arrivals std::vector _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 }; } diff --git a/libraries/networking/src/udt/SendQueue.cpp b/libraries/networking/src/udt/SendQueue.cpp index 2890d52c2b..7f1590f995 100644 --- a/libraries/networking/src/udt/SendQueue.cpp +++ b/libraries/networking/src/udt/SendQueue.cpp @@ -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);