summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Zeller <luz@synthesis.ch>2009-06-22 21:49:31 +0200
committerLukas Zeller <luz@synthesis.ch>2009-06-22 21:49:31 +0200
commit5328a5807c5ac67f7f541391ad57d3fa376316b2 (patch)
tree7bbad65b38f82b68311867a6ffd8a637f1cd4709
parent3f52d2faffd4f9d57693c1879ea6261af582346e (diff)
engine: cleaned up around fRemoteMustSeeDevinf and mustSendDevInf()
The patch by Yong Wu revealed that the mechanism needed some cleanup and better comments. - mustSendDevinf() was *intended* for derived classes to force devInf sending originally (code from around 2001). However, it was not virtual so was pretty useless (and never used). - fRemoteMustSeeDevinf was doing the same more or less independently. Now both are unified. mustSendDevinf() is now the accessor that must be called to check if devInf must be sent.
-rwxr-xr-xsrc/sysync/stdlogicds.cpp2
-rwxr-xr-xsrc/sysync/syncclient.cpp11
-rw-r--r--src/sysync/syncsession.cpp2
-rwxr-xr-xsrc/sysync/syncsession.h2
4 files changed, 12 insertions, 5 deletions
diff --git a/src/sysync/stdlogicds.cpp b/src/sysync/stdlogicds.cpp
index 8d43914..cbfafe2 100755
--- a/src/sysync/stdlogicds.cpp
+++ b/src/sysync/stdlogicds.cpp
@@ -125,7 +125,7 @@ localstatus TStdLogicDS::logicMakeAdminReady(cAppCharP aDataStoreURI, cAppCharP
// - create this session's local anchor string from timestamp
TimestampToISO8601Str(fNextLocalAnchor,fCurrentSyncTime,TCTX_UTC,false,false);
// - check if config has changed since last sync
- if (fSessionP->mustSendDevInf() || fFirstTimeSync || fPreviousSyncTime<=fSessionP->getRootConfig()->fConfigDate) {
+ if (fFirstTimeSync || fPreviousSyncTime<=fSessionP->getRootConfig()->fConfigDate) {
// remote should see our (probably changed) devInf
PDEBUGPRINTFX(DBG_PROTO,("First time sync or config changed since last sync -> remote should see our devinf"));
fSessionP->remoteMustSeeDevinf();
diff --git a/src/sysync/syncclient.cpp b/src/sysync/syncclient.cpp
index 165277b..e581f33 100755
--- a/src/sysync/syncclient.cpp
+++ b/src/sysync/syncclient.cpp
@@ -905,8 +905,15 @@ localstatus TSyncClient::NextMessage(bool &aDone)
if (localDS->fFirstTimeSync) anyfirstsyncs=true;
if (localDS->fSlowSync) anyslowsyncs=true;
}
- // create Put command if any datastore is doing first time sync / slow sync or devinf Put is externally requested
- if (fRemoteMustSeeDevinf || mustSendDevInf() || anyfirstsyncs || (anyslowsyncs && static_cast<TClientConfig *>(getRootConfig()->fAgentConfigP)->fPutDevInfAtSlowSync)) {
+ // send devinf in Put command right away with init message if either...
+ // - mustSendDevInf() returns true signalling an external condition that suggests sending devInf (like changed config)
+ // - any datastore is doing first time sync
+ // - fPutDevInfAtSlowSync is true and any datastore is doing slow sync
+ if (
+ mustSendDevInf() ||
+ anyfirstsyncs ||
+ (anyslowsyncs && static_cast<TClientConfig *>(getRootConfig()->fAgentConfigP)->fPutDevInfAtSlowSync)
+ ) {
TDevInfPutCommand *putcmdP = new TDevInfPutCommand(this);
issueRootPtr(putcmdP);
}
diff --git a/src/sysync/syncsession.cpp b/src/sysync/syncsession.cpp
index bb350a9..9d56efa 100644
--- a/src/sysync/syncsession.cpp
+++ b/src/sysync/syncsession.cpp
@@ -5098,7 +5098,7 @@ Ret_t TSyncSession::EndMessage(Boolean_t final)
// Note: do it here because we have processed all commands (alerts) now but
// server response alerts are still in the fEndOfMessageCommands queue.
// This ensures that clients gets PUT before it gets ALERTs.
- if (!fRemoteGotDevinf && fRemoteMustSeeDevinf) {
+ if (!fRemoteGotDevinf && mustSendDevInf()) {
// remote has not got devinf and should see it
if (!getRootConfig()->fNeverPutDevinf) {
// PUT devinf now
diff --git a/src/sysync/syncsession.h b/src/sysync/syncsession.h
index a04399a..a1761af 100755
--- a/src/sysync/syncsession.h
+++ b/src/sysync/syncsession.h
@@ -505,7 +505,7 @@ public:
TLocalEngineDS *aForDatastoreP
);
// access to session info from commands
- bool mustSendDevInf(void) { return false; }; // can be overridden to force devinf sending (e.g if list of synced fields has changed since last sync)
+ bool mustSendDevInf(void) { return fRemoteMustSeeDevinf; };
// - access DevInf (session owned)
SmlItemPtr_t getLocalDevInfItem(bool aAlertedOnly, bool aWithoutCTCapProps);
// - analyze devinf of remote party (can be derived to add client or server specific analysis)