handles: consolidate command prefix registrations
Previously, each command handle performs prefix registrations
separately, creating an excessive number of FIB entries in NFD.
This commit consolidates those registrations into one place,
and uses ndn::Face to dispatch Interests to command handlers.
refs #2023
Change-Id: Ia74ff970797eceac4df260e84dec727952d96489
diff --git a/tests/integrated/test-basic-command-insert-delete.cpp b/tests/integrated/test-basic-command-insert-delete.cpp
index 775a16d..28fea81 100644
--- a/tests/integrated/test-basic-command-insert-delete.cpp
+++ b/tests/integrated/test-basic-command-insert-delete.cpp
@@ -54,8 +54,13 @@
, insertFace(repoFace.getIoService())
, deleteFace(repoFace.getIoService())
{
- writeHandle.listen(Name("/repo/command"));
- deleteHandle.listen(Name("/repo/command"));
+ Name cmdPrefix("/repo/command");
+ repoFace.registerPrefix(cmdPrefix, nullptr,
+ [] (const Name& cmdPrefix, const std::string& reason) {
+ BOOST_FAIL("Command prefix registration error: " << reason);
+ });
+ writeHandle.listen(cmdPrefix);
+ deleteHandle.listen(cmdPrefix);
}
void
@@ -163,13 +168,13 @@
template<class T> void
Fixture<T>::onInsertTimeout(const Interest& interest)
{
- BOOST_ERROR("Inserert command timeout");
+ BOOST_ERROR("Insert command timeout");
}
template<class T> void
Fixture<T>::onDeleteTimeout(const Interest& interest)
{
- BOOST_ERROR("delete command timeout");
+ BOOST_ERROR("Delete command timeout");
}
template<class T> void