reset interest filter
diff --git a/ccnx/sync-ccnx-wrapper.cc b/ccnx/sync-ccnx-wrapper.cc
index bc1ea0f..d0a6376 100644
--- a/ccnx/sync-ccnx-wrapper.cc
+++ b/ccnx/sync-ccnx-wrapper.cc
@@ -59,19 +59,21 @@
void
CcnxWrapper::connectCcnd()
{
- /*
- if (m_handle != NULL)
- {
- ccn_destroy(&m_handle);
- }
- */
+ ccn_disconnect (m_handle);
_LOG_DEBUG("<<< connecting to ccnd");
if (ccn_connect(m_handle, NULL) < 0)
{
- //ccn_destroy(&m_handle);
_LOG_DEBUG("<<< connecting to ccnd failed");
BOOST_THROW_EXCEPTION (CcnxOperationException() << errmsg_info_str("connection to ccnd failed"));
}
+ if (!m_registeredInterests.empty())
+ {
+ for (map<std::string, InterestCallback>::const_iterator it = m_registeredInterests.begin(); it != m_registeredInterests.end(); ++it)
+ {
+ setInterestFilter(it->first, it->second);
+ _LOG_DEBUG("<<< registering interest filter for: " << it->first);
+ }
+ }
}
CcnxWrapper::~CcnxWrapper()
@@ -283,6 +285,7 @@
interest += compStr;
}
(*f) (interest);
+ _LOG_DEBUG("<<< processed interest: " << interest);
return CCN_UPCALL_RESULT_OK;
}
@@ -372,6 +375,8 @@
_LOG_ERROR("<<< Express interest failed: " << strInterest);
}
+ _LOG_DEBUG("<<< Sending interest: " << strInterest);
+
ccn_charbuf_destroy (&pname);
return 0;
}
@@ -394,6 +399,7 @@
BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("set interest filter failed") << errmsg_info_int (ret));
}
+ m_registeredInterests.insert(pair<std::string, InterestCallback>(prefix, interestCallback));
ccn_charbuf_destroy(&pname);
}
@@ -414,6 +420,7 @@
BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("set interest filter failed") << errmsg_info_int (ret));
}
+ m_registeredInterests.erase(prefix);
ccn_charbuf_destroy(&pname);
}