From f2ab2fb08a0112a9fe053262fd8f696a0f1318ca Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 31 Jul 2015 09:36:55 -0700 Subject: [PATCH] start with a congestion window of 16, not 25 grand --- libraries/networking/src/udt/Connection.cpp | 4 ++++ libraries/networking/src/udt/SendQueue.h | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/networking/src/udt/Connection.cpp b/libraries/networking/src/udt/Connection.cpp index 0d0140dbca..b315611cf3 100644 --- a/libraries/networking/src/udt/Connection.cpp +++ b/libraries/networking/src/udt/Connection.cpp @@ -52,6 +52,10 @@ void Connection::sendReliablePacket(unique_ptr packet) { _sendQueue = SendQueue::create(_parentSocket, _destination); QObject::connect(_sendQueue.get(), &SendQueue::packetSent, this, &Connection::packetSent); + + // set defaults on the send queue from our congestion control object + _sendQueue->setPacketSendPeriod(_congestionControl->_packetSendPeriod); + _sendQueue->setFlowWindowSize(std::min(_flowWindowSize, (int) _congestionControl->_congestionWindowSize)); } _sendQueue->queuePacket(move(packet)); diff --git a/libraries/networking/src/udt/SendQueue.h b/libraries/networking/src/udt/SendQueue.h index 24bdea27df..9c8d6878c0 100644 --- a/libraries/networking/src/udt/SendQueue.h +++ b/libraries/networking/src/udt/SendQueue.h @@ -37,8 +37,6 @@ class SendQueue : public QObject { Q_OBJECT public: - static const int DEFAULT_SEND_PERIOD = 1; // in microseconds - static std::unique_ptr create(Socket* socket, HifiSockAddr dest); void queuePacket(std::unique_ptr packet); @@ -86,11 +84,11 @@ private: SequenceNumber _currentSequenceNumber; // Last sequence number sent out std::atomic _atomicCurrentSequenceNumber;// Atomic for last sequence number sent out - std::atomic _packetSendPeriod { DEFAULT_SEND_PERIOD }; // Interval between two packet send event in microseconds + std::atomic _packetSendPeriod; // Interval between two packet send event in microseconds, set from CC std::chrono::high_resolution_clock::time_point _lastSendTimestamp; // Record last time of packet departure std::atomic _isRunning { false }; - std::atomic _flowWindowSize { udt::MAX_PACKETS_IN_FLIGHT }; // Flow control window size (number of packets that can be on wire) + std::atomic _flowWindowSize; // Flow control window size (number of packets that can be on wire) - set from CC mutable QReadWriteLock _naksLock; // Protects the naks list. LossList _naks; // Sequence numbers of packets to resend