fix bug in dispatcher about registering prefixes
unify broadcast domain in fetch-manager
diff --git a/src/dispatcher.cc b/src/dispatcher.cc
index 6635c12..a4000d8 100644
--- a/src/dispatcher.cc
+++ b/src/dispatcher.cc
@@ -59,7 +59,7 @@
m_server = new ContentServer(m_ccnx, m_actionLog, rootDir, m_localUserName, m_sharedFolder);
m_server->registerPrefix(Name ("/"));
- m_server->registerPrefix(syncPrefix);
+ m_server->registerPrefix(Name(BROADCAST_DOMAIN));
m_core = new SyncCore (m_syncLog, localUserName, Name ("/"), syncPrefix,
bind(&Dispatcher::Did_SyncLog_StateChange, this, _1), ccnx);
@@ -69,7 +69,9 @@
if (m_enablePrefixDiscovery)
{
- Ccnx::CcnxDiscovery::registerCallback (TaggedFunction (bind (&Dispatcher::Did_LocalPrefix_Updated, this, _1), "dispatcher"));
+ _LOG_DEBUG("registering prefix discovery in Dispatcher");
+ string tag = "dispatcher" + m_localUserName.toString();
+ Ccnx::CcnxDiscovery::registerCallback (TaggedFunction (bind (&Dispatcher::Did_LocalPrefix_Updated, this, _1), tag));
}
m_executor.start ();
@@ -84,7 +86,9 @@
if (m_enablePrefixDiscovery)
{
- Ccnx::CcnxDiscovery::deregisterCallback (TaggedFunction (bind (&Dispatcher::Did_LocalPrefix_Updated, this, _1), "dispatcher"));
+ _LOG_DEBUG("deregistering prefix discovery in Dispatcher");
+ string tag = "dispatcher" + m_localUserName.toString();
+ Ccnx::CcnxDiscovery::deregisterCallback (TaggedFunction (bind (&Dispatcher::Did_LocalPrefix_Updated, this, _1), tag));
}
if (m_core != NULL)
@@ -106,7 +110,7 @@
Name oldLocalPrefix = m_syncLog->LookupLocalLocator ();
_LOG_DEBUG ("LocalPrefix changed from: " << oldLocalPrefix << " to: " << prefix);
- m_server->deregisterPrefix(prefix);
+ m_server->registerPrefix(prefix);
m_syncLog->UpdateLocalLocator (prefix);
m_server->deregisterPrefix(oldLocalPrefix);
}
diff --git a/src/fetch-manager.cc b/src/fetch-manager.cc
index d30bd18..3842e2e 100644
--- a/src/fetch-manager.cc
+++ b/src/fetch-manager.cc
@@ -31,6 +31,7 @@
using namespace std;
using namespace Ccnx;
+static const string BROADCAST_DOMAIN = "/ndn/broadcast/chronoshare";
//The disposer object function
struct fetcher_disposer { void operator() (Fetcher *delete_this) { delete delete_this; } };
@@ -112,7 +113,7 @@
void
FetchManager::DidNoDataTimeout (Fetcher &fetcher)
{
- fetcher.SetForwardingHint (Ccnx::Name ("/ndn/broadcast"));
+ fetcher.SetForwardingHint (Ccnx::Name (BROADCAST_DOMAIN));
{
unique_lock<mutex> lock (m_parellelFetchMutex);
m_currentParallelFetches --;