apps: Fixing bug in ndn::ConsumerWindow---packet was not (re-)scheduled when NACK was received
diff --git a/apps/ndn-consumer-window.cc b/apps/ndn-consumer-window.cc
index bc42f67..f214a9e 100644
--- a/apps/ndn-consumer-window.cc
+++ b/apps/ndn-consumer-window.cc
@@ -134,12 +134,11 @@
{
if (m_window == static_cast<uint32_t> (0))
{
- if (!m_sendEvent.IsRunning ())
- {
- m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S) * 0.1),
- &Consumer::SendPacket, this);
- // m_rtt->IncreaseMultiplier ();
- }
+ Simulator::Remove (m_sendEvent);
+
+ NS_LOG_DEBUG ("Next event in " << (std::min<double> (0.5, m_rtt->RetransmitTimeout ().ToDouble (Time::S))) << " sec");
+ m_sendEvent = Simulator::Schedule (Seconds (std::min<double> (0.5, m_rtt->RetransmitTimeout ().ToDouble (Time::S))),
+ &Consumer::SendPacket, this);
}
else if (m_inFlight >= m_window)
{
@@ -189,7 +188,9 @@
m_window = std::max<uint32_t> (0, m_window - 1);
}
- // NS_LOG_DEBUG ("Window: " << m_window);
+ NS_LOG_DEBUG ("Window: " << m_window << ", InFlight: " << m_inFlight);
+
+ ScheduleNextPacket ();
}
void
@@ -202,6 +203,8 @@
// m_window = std::max<uint32_t> (0, m_window - 1);
m_window = m_initialWindow;
}
+
+ NS_LOG_DEBUG ("Window: " << m_window << ", InFlight: " << m_inFlight);
Consumer::OnTimeout (sequenceNumber);
}
diff --git a/model/ndn-face.cc b/model/ndn-face.cc
index 4ae7ee9..b3a43b0 100644
--- a/model/ndn-face.cc
+++ b/model/ndn-face.cc
@@ -65,12 +65,12 @@
return tid;
}
-/**
+/**
* By default, Ndn face are created in the "down" state
- * with no IP addresses. Before becoming useable, the user must
+ * with no IP addresses. Before becoming useable, the user must
* invoke SetUp on them once an Ndn address and mask have been set.
*/
-Face::Face (Ptr<Node> node)
+Face::Face (Ptr<Node> node)
: m_node (node)
, m_protocolHandler (MakeNullCallback<void,const Ptr<Face>&,const Ptr<const Packet>&> ())
, m_ifup (false)
@@ -156,7 +156,7 @@
m_rxTrace (packet);
m_protocolHandler (this, packet);
-
+
return true;
}
@@ -175,19 +175,19 @@
}
/**
- * These are face states and may be distinct from
+ * These are face states and may be distinct from
* NetDevice states, such as found in real implementations
* (where the device may be down but face state is still up).
*/
-bool
+bool
Face::IsUp (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_ifup;
}
-void
+void
Face::SetUp (bool up/* = true*/)
{
NS_LOG_FUNCTION_NOARGS ();
@@ -198,7 +198,7 @@
Face::operator== (const Face &face) const
{
NS_ASSERT_MSG (m_node->GetId () == face.m_node->GetId (),
- "Faces of different nodes should not be compared to each other");
+ "Faces of different nodes should not be compared to each other: " << *this << " == " << face);
return (m_id == face.m_id);
}
@@ -207,7 +207,7 @@
Face::operator< (const Face &face) const
{
NS_ASSERT_MSG (m_node->GetId () == face.m_node->GetId (),
- "Faces of different nodes should not be compared to each other");
+ "Faces of different nodes should not be compared to each other: " << *this << " == " << face);
return (m_id < face.m_id);
}