fix test for file serve and fetch
diff --git a/src/content-server.cc b/src/content-server.cc
index 91b6561..542f453 100644
--- a/src/content-server.cc
+++ b/src/content-server.cc
@@ -24,10 +24,11 @@
using namespace Ccnx;
using namespace std;
-ContentServer::ContentServer(CcnxWrapperPtr ccnx, ActionLogPtr actionLog, const boost::filesystem::path &rootDir)
+ContentServer::ContentServer(CcnxWrapperPtr ccnx, ActionLogPtr actionLog, const boost::filesystem::path &rootDir, int freshness)
: m_ccnx(ccnx)
, m_actionLog(actionLog)
, m_dbFolder(rootDir / ".chronoshare")
+ , m_freshness(freshness)
{
}
@@ -64,11 +65,6 @@
void
ContentServer::serve(const Name &interest)
{
- int size = interest.size();
- cout << ">>> Serving: " << interest.getPartialName(0, size - 2) << ", seq = " << interest.getCompAsInt(size -1) << endl;
-
-
-
ReadLock lock(m_mutex);
for (PrefixIt it = m_prefixes.begin(); it != m_prefixes.end(); ++it)
{
@@ -110,7 +106,14 @@
if (co)
{
- m_ccnx->publishData(interest, *co);
+ if (m_freshness > 0)
+ {
+ m_ccnx->publishData(interest, *co, m_freshness);
+ }
+ else
+ {
+ m_ccnx->publishData(interest, *co);
+ }
}
}
}
diff --git a/src/content-server.h b/src/content-server.h
index 3eb2325..994f8b9 100644
--- a/src/content-server.h
+++ b/src/content-server.h
@@ -31,7 +31,7 @@
class ContentServer
{
public:
- ContentServer(Ccnx::CcnxWrapperPtr ccnx, ActionLogPtr actionLog, const boost::filesystem::path &rootDir);
+ ContentServer(Ccnx::CcnxWrapperPtr ccnx, ActionLogPtr actionLog, const boost::filesystem::path &rootDir, int freshness = -1);
~ContentServer();
// the assumption is, when the interest comes in, interest is informs of
@@ -54,5 +54,6 @@
std::set<Ccnx::Name> m_prefixes;
Mutex m_mutex;
boost::filesystem::path m_dbFolder;
+ int m_freshness;
};
#endif // CONTENT_SERVER_H
diff --git a/src/fetcher.cc b/src/fetcher.cc
index e311461..5f731bb 100644
--- a/src/fetcher.cc
+++ b/src/fetcher.cc
@@ -96,7 +96,7 @@
Name x = Name(m_forwardingHint)(m_name)(m_minSendSeqNo+1);
int xsize = x.size();
- _LOG_DEBUG (" >>> i " << x.getPartialName(0, xsize - 2) << ", seq = " << (m_minSendSeqNo + 1 ));
+ //_LOG_DEBUG (" >>> i " << x.getPartialName(0, xsize - 2) << ", seq = " << (m_minSendSeqNo + 1 ));
// cout << ">>> " << m_minSendSeqNo+1 << endl;
m_ccnx->sendInterest (Name (m_forwardingHint)(m_name)(m_minSendSeqNo+1),