fix(cc): delay need time

This commit is contained in:
root committed 2023-12-18 20:57:24 +08:00
1 parent 1675c0aca0
commit 9648808618
3 files changed
+7 -5

No files matched your search

+4 -3
View File
@@ -38,8 +38,9 @@ namespace ndn
m_traceTimes++;
// print rate
std::cout << "cc:rate:<" << m_traceTimes << "," << m_recvBytes << ">" << std::endl;
std::cout << "cc:rate:<" << m_traceTimes << "," << m_recvBytes << ">" << m_nSent << std::endl;
m_recvBytes = 0;
m_nSent = 0;
}
void Consumer::start()
@@ -114,9 +115,9 @@ namespace ndn
void Consumer::onData(const Data &data, uint64_t seq, const time::steady_clock::TimePoint &sendTime)
{
auto now = time::steady_clock::now();
std::cout << "cc:delay:<" << seq << "," << (now - sendTime).count() << ">" << std::endl;
std::cout << "cc:delay:<" << (now - m_startTime).count() << "," << seq << "," << (now - sendTime).count() << ">" << std::endl;
afterData(seq, time::steady_clock::now() - sendTime);
afterData(seq, now - sendTime);
m_recvBytes += data.wireEncode().size();
// finish();
}
+1
View File
@@ -74,6 +74,7 @@ namespace ndn
uint64_t m_recvBytes;
uint64_t m_traceTimes;
time::steady_clock::TimePoint m_startTime;
/// @cond include_hidden
/**
* \struct This struct contains sequence numbers of packets to be retransmitted
+2 -2
View File
@@ -80,6 +80,7 @@ namespace ndn
}
if (this->m_firstTime)
{
m_startTime = time::steady_clock::now();
this->m_firstTime = false;
if (this->fixedRate > 0)
@@ -114,6 +115,7 @@ namespace ndn
void QsccpConsumer::sendPacket()
{
scheduleNextPacket();
// send packet here
uint32_t seq = std::numeric_limits<uint32_t>::max(); // invalid
while (m_retxSeqs.size())
@@ -152,8 +154,6 @@ namespace ndn
++m_nSent;
++m_nOutstanding;
scheduleNextPacket();
}
}
}