Solving some deadlocks and crashes

It is still some mystery with two clients and delays
diff --git a/model/sync-app-socket.cc b/model/sync-app-socket.cc
index 2f1d174..42d34e4 100644
--- a/model/sync-app-socket.cc
+++ b/model/sync-app-socket.cc
@@ -44,8 +44,8 @@
 
 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.getNextSeq (prefix, session));
+  uint32_t sequence = m_publisher.publishData (prefix, session, dataBuffer, freshness);
+  m_syncLogic.addLocalNames (prefix, session, sequence);
 }
 
 }