From e1df9e73e9b06f1a9aed61b41b87471605a92be3 Mon Sep 17 00:00:00 2001 From: Chen Congwu Date: Thu, 11 Mar 2010 14:41:10 +0800 Subject: Valgrind warning fixed: initialize the conditonal variables --- src/sysync/syncsession.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/sysync/syncsession.cpp b/src/sysync/syncsession.cpp index c7e5d8b..a1684e1 100644 --- a/src/sysync/syncsession.cpp +++ b/src/sysync/syncsession.cpp @@ -947,6 +947,11 @@ TSyncSession::TSyncSession( // assume normal, full-featured session. Profile config or session progress might set this flag later fLegacyMode = false; fLenientMode = false; + + //initialize the conditonal variables to keep valgrind happy + fNeedAuth = true; + fRemoteRequestedAuth = auth_none; + #ifdef SYDEBUG // initialize session debug logging fSessionDebugLogs=getRootConfig()->fDebugConfig.fSessionDebugLogs; /// init from config @todo: get rid of this special session level flag, handle it all via session logger's fDebugEnabled / getDbgMask() -- cgit v1.2.3 From ce704f6f521e9153d801f47d750a9a45fcc6f507 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 15 Mar 2010 16:16:32 +0100 Subject: resume + pending item fix in SyncML server When an item that was split among messages was finally reassembled and processed by the server, the status sent to the client was not properly stored in the admin data. As a result of that, when the session got suspended directly after sending that status, the client would resume, send the last item chunk again, but then not get the previous status. Instead the server attempted to parse the incomplete item and failed. The root cause was that TSyncSession::process() was called recursively. The inner one for the incomplete command saved the status in fLastItemStatus. The outer one then later didn't have a status pointer, fell back to status 0 and overwrote the valid status. This patch solves this by suppressing that second updating of fLastItemStatus and all related fields if the item was handled by an inner process() call. --- src/sysync/synccommand.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sysync/synccommand.cpp b/src/sysync/synccommand.cpp index 1892b24..73560cc 100755 --- a/src/sysync/synccommand.cpp +++ b/src/sysync/synccommand.cpp @@ -2270,6 +2270,7 @@ bool TSyncOpCommand::execute(void) localstatus sta; TSyncOpCommand *incompleteCmdP; bool queueforlater,processitem; + bool nostatus; SmlItemListPtr_t tobequeueditems=NULL; SYSYNC_TRY { @@ -2292,6 +2293,7 @@ bool TSyncOpCommand::execute(void) while (*itemnodePP) { queueforlater=false; // do no queue by default processitem=true; // process by default + nostatus=false; // set to true if someone else is responsible for updating fLastItemStatus thisitemnode = *itemnodePP; // no result nor status so far statusCmdP=NULL; @@ -2531,7 +2533,10 @@ bool TSyncOpCommand::execute(void) // - first remove global link to it to avoid recursion fSessionP->fIncompleteDataCommandP=NULL; // - execute now (and pass ownership) - // issues appropriate statuses + // issues appropriate statuses, so we don't need to deal with it; + // in fact, we must not touch fLastItemStatus because we don't + // know the status + nostatus=true; fSessionP->process(incompleteCmdP); // - this item is processed now, continue in loop if there are more items processitem=false; // do not process the item normally @@ -2628,7 +2633,7 @@ bool TSyncOpCommand::execute(void) // item processed // - remember status (final only) for possible suspend and resume sta= statusCmdP ? statusCmdP->getStatusCode() : 0; - if (sta!=213) { + if (!nostatus && sta!=213) { // final status received, save it for possible resend fDataStoreP->fLastItemStatus = sta; // but forget data stored at DS level -- cgit v1.2.3