Integrate name change (add /ndn/multicast/ prefix). Additionally updated unit tests to test cases of
many torrent segments and many manifests.
Change-Id: Ieb3b3971fb09e31ddb15d85b5907ee7be41ef1ba
diff --git a/src/torrent-manager.cpp b/src/torrent-manager.cpp
index 110d90f..892228f 100644
--- a/src/torrent-manager.cpp
+++ b/src/torrent-manager.cpp
@@ -17,6 +17,7 @@
#include <string>
#include <unordered_map>
#include <vector>
+#include <boost/asio/io_service.hpp>
namespace fs = boost::filesystem;
@@ -32,7 +33,6 @@
security::KeyChain key_chain;
Name currSegmentFullName = initialSegmentName;
vector<TorrentFile> torrentSegments = IoUtil::load_directory<TorrentFile>(torrentFilePath);
-
// Starting with the initial segment name, verify the names, loading next name from torrentSegment
for (auto it = torrentSegments.begin(); it != torrentSegments.end(); ++it) {
TorrentFile& segment = *it;
@@ -169,10 +169,10 @@
// figure out the name of the torrent
Name torrentName;
if (m_torrentFileName.get(m_torrentFileName.size() - 2).isSequenceNumber()) {
- torrentName = m_torrentFileName.getSubName(1, m_torrentFileName.size() - 4);
+ torrentName = m_torrentFileName.getSubName(3, m_torrentFileName.size() - 6);
}
else {
- torrentName = m_torrentFileName.getSubName(1, m_torrentFileName.size() - 3);
+ torrentName = m_torrentFileName.getSubName(3, m_torrentFileName.size() - 5);
}
// TODO(spyros) Get update manager working
@@ -406,7 +406,6 @@
this->sendInterest();
if (m_pendingInterests.empty() && m_interestQueue->empty() && !m_seedFlag) {
shutdown();
- return;
}
};
@@ -520,6 +519,12 @@
bind(&TorrentManager::onRegisterFailed, this, _1, _2));
}
+void
+TorrentManager::shutdown()
+{
+ m_face->getIoService().stop();
+}
+
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// Protected Helpers
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
@@ -650,7 +655,6 @@
this->sendInterest();
if (m_pendingInterests.empty() && m_interestQueue->empty() && !m_seedFlag) {
shutdown();
- return;
}
};