diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2014-08-29 10:35:47 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2014-08-29 10:35:47 +0200 |
commit | 4683fceb72cef0e7301b735a23b1f40323da52ba (patch) | |
tree | 48c08af03f369b092a440aada727e52ab7a16752 | |
parent | 3e3f6ac3362b902fee80b1c76a0c78f9f5cddfa2 (diff) |
syncsession: avoid unnecessary nonce update
When the configure auth type needs no nonce, don't generate one
and return NULL immediately, like newChallenge() would do.
That avoids unnecessary disk writes for storing the new nonce, which
is important for local syncs in IVI. It also avoids debug output about
a challenge that would not get sent.
-rw-r--r-- | src/sysync/syncsession.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sysync/syncsession.cpp b/src/sysync/syncsession.cpp index 54c119c..f7c7a11 100644 --- a/src/sysync/syncsession.cpp +++ b/src/sysync/syncsession.cpp @@ -4061,15 +4061,22 @@ bool TSyncSession::processSyncOpItem( // generate challenge for session SmlChalPtr_t TSyncSession::newSessionChallenge(void) { + sysync::TAuthTypes auth = requestedAuthType(); + + // Avoid misleading debug output (there is no challenge) + // and more importantly, creating a new nonce that is not + // going to be used. That causes unnecessary disk writes. + if (auth == sysync::auth_none) return NULL; + string nonce; getNextNonce(fRemoteURI.c_str(),nonce); PDEBUGPRINTFX(DBG_PROTO,( "Challenge for next auth: AuthType=%s, Nonce='%s', binary %sallowed", - authTypeSyncMLNames[requestedAuthType()], + authTypeSyncMLNames[auth], nonce.c_str(), getEncoding()==SML_WBXML ? "" : "NOT " )); - return newChallenge(requestedAuthType(),nonce,getEncoding()==SML_WBXML); + return newChallenge(auth,nonce,getEncoding()==SML_WBXML); } // TSyncSession::newSessionChallenge |