modify data publish class; get next seq instead of highest seq
diff --git a/model/sync-app-data-publish.cc b/model/sync-app-data-publish.cc
index bc1281b..faaf482 100644
--- a/model/sync-app-data-publish.cc
+++ b/model/sync-app-data-publish.cc
@@ -42,7 +42,7 @@
 }
 
 uint32_t
-AppDataPublish::getHighestSeq (const string &prefix, uint32_t session)
+AppDataPublish::getNextSeq (const string &prefix, uint32_t session)
 {
   unordered_map<string, Seq>::iterator i = m_sequenceLog.find(prefix);
 
@@ -62,22 +62,22 @@
   uint32_t seq = 0;
 	try
 		{
-			seq =  getHighestSeq(name, session);
+			seq =  getNextSeq(name, session);
 		}
 	catch (GetSeqException &e){
     m_sequenceLog.erase(name);
 	}
 
-  Seq s;
-  s.session = session;
-  s.seq = seq;
-  m_sequenceLog[name] = s;
-
   ostringstream contentNameWithSeqno;
   contentNameWithSeqno << name << "/" << session << "/" << seq;
 
   m_ccnxHandle->publishData (contentNameWithSeqno.str (), dataBuffer, freshness);
 
+  Seq s;
+  s.session = session;
+  s.seq = seq + 1;
+  m_sequenceLog[name] = s;
+
   unordered_map<pair<string, uint32_t>, string>::iterator it = m_recentData.find(make_pair(name, session));
   if (it != m_recentData.end()) 
     m_recentData.erase(it);
diff --git a/model/sync-app-data-publish.h b/model/sync-app-data-publish.h
index 204a076..85bb9ae 100644
--- a/model/sync-app-data-publish.h
+++ b/model/sync-app-data-publish.h
@@ -68,7 +68,7 @@
    * @param session session
    */
   uint32_t
-  getHighestSeq (const std::string &prefix, uint32_t session);
+  getNextSeq (const std::string &prefix, uint32_t session);
 
   /**
    * @brief publish data for a name prefix, updates the corresponding
diff --git a/model/sync-app-socket.cc b/model/sync-app-socket.cc
index 3dca250..fb6779d 100644
--- a/model/sync-app-socket.cc
+++ b/model/sync-app-socket.cc
@@ -46,7 +46,7 @@
 bool SyncAppSocket::publish (const string &prefix, uint32_t session, const string &dataBuffer, int freshness)
 {
   m_publisher.publishData (prefix, session, dataBuffer, freshness);
-  m_syncLogic.addLocalNames (prefix, session, m_publisher.getHighestSeq (prefix, session));
+  m_syncLogic.addLocalNames (prefix, session, m_publisher.getNextSeq (prefix, session));
 }
 
 }
diff --git a/test/test_data_fetch_and_publish.cc b/test/test_data_fetch_and_publish.cc
index a442830..b1e7647 100644
--- a/test/test_data_fetch_and_publish.cc
+++ b/test/test_data_fetch_and_publish.cc
@@ -67,7 +67,7 @@
   TestStructApp bar;
 	
   string interest = "/april/fool";
-  string seq[5] = {"1", "2", "3", "4", "5"};
+  string seq[5] = {"0", "1", "2", "3", "4" };
   string str[5] = {"panda", "express", "tastes", "so", "good"};
 
   for (int i = 0; i < 5; i++) {
@@ -86,10 +86,10 @@
     publisher.publishData(interest, 0, str[i - 1], 5);
   }
 
-  BOOST_CHECK_EQUAL(publisher.getHighestSeq(interest, 0), 5);
+  BOOST_CHECK_EQUAL(publisher.getNextSeq(interest, 0), 5);
   BOOST_CHECK_EQUAL(publisher.getRecentData(interest, 0), str[4]);
 
-  fetcher.onUpdate (interest, SeqNo (0,5), SeqNo (0,0));
+  fetcher.onUpdate (interest, SeqNo (0,4), SeqNo (0,-1));
   // give time for ccnd to react
   sleep(1);
   BOOST_CHECK_EQUAL(foo.toString(), bar.toString());
@@ -99,7 +99,7 @@
     bind(&TestStructApp::erase, &bar, _1, _2);
   fetcher.setDataCallback(eraseFunc);
 
-  fetcher.onUpdate (interest, SeqNo (0,5), SeqNo (0,0));
+  fetcher.onUpdate (interest, SeqNo (0,4), SeqNo (0,-1));
   // give time for ccnd to react
   sleep(1);
   TestStructApp poo;