Repair serious bug with caching (wrong packet was sent from cache)
diff --git a/helper/ccnx-header-helper.cc b/helper/ccnx-header-helper.cc
index 8fcd9d7..d3a3400 100644
--- a/helper/ccnx-header-helper.cc
+++ b/helper/ccnx-header-helper.cc
@@ -43,6 +43,7 @@
if (read!=2) throw CcnxUnknownHeaderException();
+ NS_LOG_DEBUG (*packet);
if (type[0] == INTEREST_BYTE0 && type[1] == INTEREST_BYTE1)
{
return CcnxHeaderHelper::INTEREST;
@@ -52,6 +53,7 @@
return CcnxHeaderHelper::CONTENT_OBJECT;
}
+ NS_LOG_DEBUG (*packet);
throw CcnxUnknownHeaderException();
}
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index 19ec448..25cc0a5 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -150,6 +150,7 @@
CcnxFace::Send (Ptr<Packet> packet)
{
NS_LOG_FUNCTION (boost::cref (*this) << packet << packet->GetSize ());
+ NS_LOG_DEBUG (*packet);
/// \todo Implement tracing, if requested
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index d216b4f..83ab9d2 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -260,6 +260,11 @@
void
CcnxL3Protocol::Receive (const Ptr<CcnxFace> &face, const Ptr<const Packet> &p)
{
+ if (!face->IsUp ())
+ return;
+
+ NS_LOG_DEBUG (*p);
+
NS_LOG_LOGIC ("Packet from face " << *face << " received on node " << m_node->GetId ());
Ptr<Packet> packet = p->Copy (); // give upper layers a rw copy of the packet
@@ -302,6 +307,8 @@
catch (CcnxUnknownHeaderException)
{
NS_ASSERT_MSG (false, "Unknown CCNx header. Should not happen");
+ NS_LOG_ERROR ("Unknown CCNx header. Should not happen");
+ return;
}
}
@@ -483,7 +490,7 @@
NS_ASSERT (contentObjectHeader != 0);
NS_LOG_LOGIC("Found in cache");
- OnDataDelayed (contentObjectHeader, contentObject, payload);
+ OnDataDelayed (contentObjectHeader, payload, contentObject);
return;
}
@@ -525,7 +532,7 @@
bool propagated = m_forwardingStrategy->
PropagateInterest (pitEntry, incomingFace, header, packet);
- if (isRetransmitted) //give another chance if retransmitted
+ if (!propagated && isRetransmitted) //give another chance if retransmitted
{
// increase max number of allowed retransmissions
m_pit->modify (m_pit->iterator_to (pitEntry),