Remove use of deprecated code

Change-Id: I197471c48c54c5671bb8f641c4332b3ac7893824
Refs: #3988
diff --git a/nsync/sync-logic.cc b/nsync/sync-logic.cc
index 900c424..b1482cf 100644
--- a/nsync/sync-logic.cc
+++ b/nsync/sync-logic.cc
@@ -218,7 +218,7 @@
 }
 
 void
-SyncLogic::onSyncData(const ndn::Interest& interest, Data& data)
+SyncLogic::onSyncData(const ndn::Interest& interest, const Data& data)
 {
   OnDataValidated onValidated = bind(&SyncLogic::onSyncDataValidated, this, _1);
   OnDataValidationFailed onValidationFailed = bind(&SyncLogic::onSyncDataValidationFailed, this, _1);
@@ -624,6 +624,7 @@
 
   m_face->expressInterest(interest,
                           bind(&SyncLogic::onSyncData, this, _1, _2),
+                          bind(&SyncLogic::onSyncTimeout, this, _1), // Nack
                           bind(&SyncLogic::onSyncTimeout, this, _1));
 }
 
@@ -652,6 +653,7 @@
 
   m_face->expressInterest(interest,
                           bind(&SyncLogic::onSyncData, this, _1, _2),
+                          bind(&SyncLogic::onSyncTimeout, this, _1), // Nack
                           bind(&SyncLogic::onSyncTimeout, this, _1));
 }
 
diff --git a/nsync/sync-logic.h b/nsync/sync-logic.h
index 33578fb..6ac330b 100644
--- a/nsync/sync-logic.h
+++ b/nsync/sync-logic.h
@@ -127,7 +127,7 @@
   onSyncRegisterFailed(const ndn::Name& prefix, const std::string& msg);
 
   void
-  onSyncData(const ndn::Interest& interest, ndn::Data& data);
+  onSyncData(const ndn::Interest& interest, const ndn::Data& data);
 
   void
   onSyncTimeout(const ndn::Interest& interest);
diff --git a/nsync/sync-socket.cc b/nsync/sync-socket.cc
index 68eaa7d..ef6b9fb 100644
--- a/nsync/sync-socket.cc
+++ b/nsync/sync-socket.cc
@@ -112,13 +112,15 @@
   m_face->expressInterest(interest,
                           bind(&SyncSocket::onData, this, _1, _2,
                                onValidated, onValidationFailed),
+                          bind(&SyncSocket::onDataTimeout, this, _1, retry, // Nack
+                               onValidated, onValidationFailed),
                           bind(&SyncSocket::onDataTimeout, this, _1, retry,
                                onValidated, onValidationFailed));
 
 }
 
 void
-SyncSocket::onData(const ndn::Interest& interest, Data& data,
+SyncSocket::onData(const ndn::Interest& interest, const Data& data,
                    const OnDataValidated& onValidated,
                    const OnDataValidationFailed& onValidationFailed)
 {
@@ -145,6 +147,12 @@
                                    _1,
                                    retry - 1,
                                    onValidated,
+                                   onValidationFailed),
+                              bind(&SyncSocket::onDataTimeout,
+                                   this,
+                                   _1,
+                                   retry - 1,
+                                   onValidated,
                                    onValidationFailed));
 
     }
diff --git a/nsync/sync-socket.h b/nsync/sync-socket.h
index dce6fde..35b59c3 100644
--- a/nsync/sync-socket.h
+++ b/nsync/sync-socket.h
@@ -106,7 +106,7 @@
   }
 
   void
-  onData(const ndn::Interest& interest, ndn::Data& data,
+  onData(const ndn::Interest& interest, const ndn::Data& data,
          const ndn::OnDataValidated& onValidated,
          const ndn::OnDataValidationFailed& onValidationFailed);