mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 08:59:41 +02:00
remove onPacketSent and onPacketReceived from CC, use setRTT
This commit is contained in:
parent
0e0968f748
commit
cb134f4685
2 changed files with 9 additions and 2 deletions
|
@ -20,9 +20,11 @@ namespace udt {
|
|||
|
||||
static const int32_t DEFAULT_SYN_INTERVAL = 10000; // 10 ms
|
||||
|
||||
class Connection;
|
||||
class Packet;
|
||||
|
||||
class CongestionControl {
|
||||
friend class Connection;
|
||||
public:
|
||||
|
||||
CongestionControl() {};
|
||||
|
@ -35,8 +37,6 @@ public:
|
|||
virtual void close() {}
|
||||
virtual void onAck(SequenceNumber ackNum) {}
|
||||
virtual void onLoss(const std::vector<SequenceNumber>& lossList) {}
|
||||
virtual void onPacketSent(const Packet& packet) {}
|
||||
virtual void onPacketReceived(const Packet& packet) {}
|
||||
|
||||
protected:
|
||||
void setAckTimer(int period) { _ackPeriod = (period > _synInterval) ? _synInterval : period; }
|
||||
|
|
|
@ -336,6 +336,7 @@ void Connection::processACK(std::unique_ptr<ControlPacket> controlPacket) {
|
|||
updateRTT(rtt);
|
||||
|
||||
// set the RTT for congestion control
|
||||
_congestionControl->setRtt(_rtt);
|
||||
|
||||
if (controlPacket->getPayloadSize() > (qint64) (sizeof(SequenceNumber) + sizeof(SequenceNumber) + sizeof(rtt))) {
|
||||
int32_t deliveryRate, bandwidth;
|
||||
|
@ -343,6 +344,8 @@ void Connection::processACK(std::unique_ptr<ControlPacket> controlPacket) {
|
|||
controlPacket->readPrimitive(&bandwidth);
|
||||
|
||||
// set the delivery rate and bandwidth for congestion control
|
||||
_congestionControl->setRcvRate(deliveryRate);
|
||||
_congestionControl->setBandwidth(bandwidth);
|
||||
}
|
||||
|
||||
// fire the onACK callback for congestion control
|
||||
|
@ -387,6 +390,7 @@ void Connection::processACK2(std::unique_ptr<ControlPacket> controlPacket) {
|
|||
updateRTT(rtt);
|
||||
|
||||
// set the RTT for congestion control
|
||||
_congestionControl->setRtt(_rtt);
|
||||
|
||||
// update the last ACKed ACK
|
||||
if (pair.first > _lastReceivedAcknowledgedACK) {
|
||||
|
@ -401,10 +405,13 @@ void Connection::processNAK(std::unique_ptr<ControlPacket> controlPacket) {
|
|||
// read the loss report
|
||||
SequenceNumber start, end;
|
||||
controlPacket->readPrimitive(&start);
|
||||
|
||||
if (controlPacket->bytesLeftToRead() >= (qint64)sizeof(SequenceNumber)) {
|
||||
controlPacket->readPrimitive(&end);
|
||||
}
|
||||
|
||||
|
||||
|
||||
++_totalReceivedNAKs;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue