Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a single source of truth for InFlight calculation #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions apps/ndn-consumer-pcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ ConsumerPcon::OnData(shared_ptr<const Data> data)
WindowIncrease();
}

if (m_inFlight > static_cast<uint32_t>(0)) {
m_inFlight--;
}
m_inFlight = m_seqTimeouts.size();

NS_LOG_DEBUG("Window: " << m_window << ", InFlight: " << m_inFlight);

Expand All @@ -140,9 +138,7 @@ ConsumerPcon::OnTimeout(uint32_t sequenceNum)
{
WindowDecrease();

if (m_inFlight > static_cast<uint32_t>(0)) {
m_inFlight--;
}
m_inFlight = m_seqTimeouts.size();

NS_LOG_DEBUG("Window: " << m_window << ", InFlight: " << m_inFlight);

Expand Down
5 changes: 2 additions & 3 deletions apps/ndn-consumer-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ ConsumerWindow::OnData(shared_ptr<const Data> contentObject)
void
ConsumerWindow::OnTimeout(uint32_t sequenceNumber)
{
if (m_inFlight > static_cast<uint32_t>(0))
m_inFlight--;
m_inFlight = m_seqTimeouts.size();

if (m_setInitialWindowOnTimeout) {
// m_window = std::max<uint32_t> (0, m_window - 1);
Expand All @@ -214,8 +213,8 @@ ConsumerWindow::OnTimeout(uint32_t sequenceNumber)
void
ConsumerWindow::WillSendOutInterest(uint32_t sequenceNumber)
{
m_inFlight++;
Consumer::WillSendOutInterest(sequenceNumber);
m_inFlight = m_seqTimeouts.size();
}

} // namespace ndn
Expand Down