Bug #3363
closed
Interest with full name is not satisfied with Data packet
Added by Alex Afanasyev about 10 years ago.
Updated almost 10 years ago.
Description
The problem originally reported by Christian Tschudin: http://www.lists.cs.ucla.edu/pipermail/nfd-dev/2015-December/001445.html
I'm confirming the incorrect behavior. Steps to reproduce:
Start NFD
Compile a simple app:
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <memory>
int
main()
{
auto data = std::make_shared<ndn::Data>("/hello/world");
ndn::KeyChain keyChain;
keyChain.sign(*data);
std::cout << data->getFullName() << std::endl;
ndn::Face face;
face.setInterestFilter("/hello/world",
[&] (const ndn::InterestFilter&, const ndn::Interest& i) {
std::cerr << " << i " << i << std::endl;
if (i.getName() == data->getFullName()) {
face.put(*data);
}
},
nullptr);
face.processEvents();
}
c++ -std=c++11 `pkg-config --cflags --libs libndn-cxx` test.cpp -lndn-cxx
Start the app. It will output the exact name of the data packet being produced. On my machine it is /hello/world/sha256digest=bc6f07c5f4e6e2ec525dc2a6ad95ddc02df2c39140e1bfd791d43c48ef7abf6c
Request the data packet using ndnpeek
ndnpeek /hello/world/sha256digest=bc6f07c5f4e6e2ec525dc2a6ad95ddc02df2c39140e1bfd791d43c48ef7abf6c
Expected: Data packet retrieved
Actual: Timeout
If ndnpeek is run again, the data packet is immediately retrieved.
Files
This patch would fix the issue
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index 959593f..79c7431 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -24,7 +24,6 @@
*/
#include "pit.hpp"
-#include <type_traits>
#include <boost/concept/assert.hpp>
#include <boost/concept_check.hpp>
@@ -94,7 +93,7 @@ Pit::findOrInsert(const Interest& interest, bool allowInsert)
pit::DataMatchResult
Pit::findAllDataMatches(const Data& data) const
{
- auto&& ntMatches = m_nameTree.findAllMatches(data.getName(),
+ auto&& ntMatches = m_nameTree.findAllMatches(data.getFullName(),
[] (const name_tree::Entry& entry) { return entry.hasPitEntries(); });
pit::DataMatchResult matches;
However, there is immediate implication that implicit digest is forced to be compiled for every incoming data packet. This is what we tried to avoid previously.
I think there could be a workaround, though it would require modification of NameTree lookup.
- Assignee changed from Junxiao Shi to Alex Afanasyev
20151215 conference call decides to adopt note-1 solution as the short-term solution, under the condition that NdnCon does not suffer from the performance implication.
Alex will inform NdnCon developers to do a test with the patch.
See Scanned_20151230-1031.pdf for my solution that does not involve digest computation on every Data packet.
Estimated time to implement this solution is 3 hours.
- Assignee changed from Alex Afanasyev to Junxiao Shi
- Target version changed from v0.4 to v0.5
Jan 5, 2016 call decided to proceed with solution in note-4.
- Status changed from New to In Progress
- Estimated time set to 4.00 h
- % Done changed from 0 to 10
- % Done changed from 10 to 50
patchset2 has the implementation and existing tests are passing.
However, I haven't updated the shortcut methods so some of them will likely fail.
- % Done changed from 50 to 80
patchset3 adds test cases for FIB/StrategyChoice/Measurements shortcut methods, which are failing as expected.
- Status changed from In Progress to Code review
- % Done changed from 80 to 100
patchset4 modifies NameTree::get(pit::Entry&) to accommodate PIT behavior change.
I'm introducing a new parameter missingBehavior to this method, to avoid inserting a new NameTree entry if the calling table does not intend to attach a new entry onto it.
This is used by FIB, but not by Measurements or StrategyChoice.
- Status changed from Code review to Resolved
Code change is merged.
I still need to update devguide "NameTree - shortcuts" section.
- Status changed from Resolved to Closed
NFD devguide "NameTree - shortcuts" section is updated in nfd-docs:commit:74b6084405589af18a3074be5b3815223b07b02f.
- Related to Bug #3608: Pit::erase crash if Interest name contains implicit digest added
Also available in: Atom
PDF