Merge remote-tracking branch 'git.irl/alex'

Conflicts:
	ccnx/ccnx-wrapper.cpp
diff --git a/ccnx/ccnx-wrapper.cpp b/ccnx/ccnx-wrapper.cpp
index d168dba..d584be4 100644
--- a/ccnx/ccnx-wrapper.cpp
+++ b/ccnx/ccnx-wrapper.cpp
@@ -205,15 +205,24 @@
 int
 CcnxWrapper::putToCcnd (const Bytes &contentObject)
 {
+  _LOG_TRACE (">> putToCcnd");
   UniqueRecLock lock(m_mutex);
   if (!m_running || !m_connected)
-    return -1;
+    {
+      _LOG_TRACE ("<< not running or connected");
+      return -1;
+    }
 
 
   if (ccn_put(m_handle, head(contentObject), contentObject.size()) < 0)
   {
+    _LOG_ERROR ("ccn_put failed");
     // BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("ccnput failed"));
   }
+  else
+    {
+      _LOG_DEBUG ("<< putToCcnd");
+    }
 
   return 0;
 }
@@ -238,24 +247,29 @@
                  ccn_upcall_info *info)
 {
   CcnxWrapper::InterestCallback *f = static_cast<CcnxWrapper::InterestCallback*> (selfp->data);
+  _LOG_TRACE (">> incomingInterest upcall");
 
   switch (kind)
     {
     case CCN_UPCALL_FINAL: // effective in unit tests
       delete f;
       delete selfp;
+      _LOG_TRACE ("<< incomingInterest with CCN_UPCALL_FINAL");
       return CCN_UPCALL_RESULT_OK;
 
     case CCN_UPCALL_INTEREST:
       break;
 
     default:
+      _LOG_TRACE ("<< incomingInterest with CCN_UPCALL_RESULT_OK");
       return CCN_UPCALL_RESULT_OK;
     }
 
   Name interest(info->interest_ccnb, info->interest_comps);
 
   (*f) (interest);
+
+  _LOG_TRACE ("<< incomingInterest");
   return CCN_UPCALL_RESULT_OK;
 }
 
@@ -265,6 +279,7 @@
              ccn_upcall_info *info)
 {
   Closure *cp = static_cast<Closure *> (selfp->data);
+  _LOG_TRACE (">> incomingData upcall");
 
   switch (kind)
     {
@@ -272,6 +287,7 @@
       delete cp;
       cp = NULL;
       delete selfp;
+      _LOG_TRACE ("<< incomingData with CCN_UPCALL_FINAL");
       return CCN_UPCALL_RESULT_OK;
 
     case CCN_UPCALL_CONTENT:
@@ -280,6 +296,7 @@
     case CCN_UPCALL_INTEREST_TIMED_OUT: {
       if (cp != NULL)
       {
+        _LOG_TRACE ("<< incomingData timeout");
         Name interest(info->interest_ccnb, info->interest_comps);
         Closure::TimeoutCallbackReturnValue rv = cp->runTimeoutCallback(interest);
         switch(rv)
@@ -289,6 +306,10 @@
           default : break;
         }
       }
+      else
+        {
+          _LOG_TRACE ("<< incomingData timeout, but callback is not set...");
+        }
       return CCN_UPCALL_RESULT_OK;
     }
 
@@ -314,15 +335,21 @@
 
   cp->runDataCallback (pco->name (), pco);
 
+  _LOG_TRACE (">> incomingData");
+
   return CCN_UPCALL_RESULT_OK;
 }
 
 int CcnxWrapper::sendInterest (const Name &interest, const Closure &closure, const Selectors &selectors)
 {
+  _LOG_TRACE (">> sendInterest");
   {
     UniqueRecLock lock(m_mutex);
     if (!m_running || !m_connected)
-      return -1;
+      {
+        _LOG_ERROR ("<< sendInterest: not running or connected");
+        return -1;
+      }
   }
 
   CcnxCharbufPtr namePtr = interest.toCcnxCharbuf();
@@ -344,17 +371,20 @@
   UniqueRecLock lock(m_mutex);
   if (ccn_express_interest (m_handle, pname, dataClosure, templ) < 0)
   {
+    _LOG_ERROR ("<< sendInterest: ccn_express_interest FAILED!!!");
   }
 
+  _LOG_TRACE ("<< sendInterest");
+
   return 0;
 }
 
 int CcnxWrapper::setInterestFilter (const Name &prefix, const InterestCallback &interestCallback)
 {
-  {
-    UniqueRecLock lock(m_mutex);
-    if (!m_running || !m_connected)
-      return -1;
+  _LOG_TRACE (">> setInterestFilter");
+  UniqueRecLock lock(m_mutex);
+  if (!m_running || !m_connected)
+    return -1;
   }
 
   CcnxCharbufPtr ptr = prefix.toCcnxCharbuf();
@@ -368,9 +398,12 @@
   int ret = ccn_set_interest_filter (m_handle, pname, interestClosure);
   if (ret < 0)
   {
+    _LOG_ERROR ("<< setInterestFilter: ccn_set_interest_filter FAILED");
   }
 
   m_registeredInterests.insert(pair<Name, InterestCallback>(prefix, interestCallback));
+  
+  _LOG_TRACE ("<< setInterestFilter");
 
   return ret;
 }
@@ -378,6 +411,7 @@
 void
 CcnxWrapper::clearInterestFilter (const Name &prefix)
 {
+  _LOG_TRACE (">> clearInterestFilter");
   UniqueRecLock lock(m_mutex);
   if (!m_running || !m_connected)
     return;
@@ -391,6 +425,8 @@
   }
 
   m_registeredInterests.erase(prefix);
+
+  _LOG_TRACE ("<< clearInterestFilter");
 }
 
 Name