diff -r 02e387d99c91 -r 70467d598794 connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.cpp --- a/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.cpp Tue Aug 25 09:33:36 2009 -0500 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.cpp Tue Aug 25 09:44:48 2009 -0500 @@ -480,6 +480,7 @@ long bytesRemaining = m_numberBytes; long usedLen = 0; bool done = false; + long numberSkipped=0; while (!done) { @@ -488,7 +489,21 @@ BYTE* fullMessage = ptr; BYTE* rawMessage = ptr; BYTE msgId = 0; - if (m_Protocol->DecodeMessage(fullMessage, fullMessageLength, msgId, rawMessage, rawLength)) + int result = m_Protocol->DecodeMessage(fullMessage, fullMessageLength, msgId, rawMessage, rawLength); + if (result == DECODE_NOT_ENOUGH_BYTES_TO_SEARCH) + { + done = true; + } + else if (result == DECODE_MESSAGE_NOT_FOUND) + { + numberSkipped++; + usedLen += fullMessageLength; + bytesRemaining -= fullMessageLength; + ptr += fullMessageLength; + if (bytesRemaining < protocolHeaderLength) + done = true; + } + else if (result == DECODE_MESSAGE_FOUND) { err = PreProcessMessage(msgId, fullMessageLength, fullMessage); if (err != TCAPI_ERR_NONE) @@ -502,7 +517,7 @@ } #ifdef _DEBUG int reallen = fullMessageLength; - if (reallen > 50) reallen = 50; + if (reallen > 80) reallen = 80; char msg[6]; msg[0] = '\0'; @@ -512,13 +527,20 @@ sTcpLogMsg[0] = '\0'; for (int i = 0; i < reallen; i++) { - sprintf(msg, "%02.2x ", ptr[i]); + if (isalnum(ptr[i])) + { + sprintf(msg, "%c", ptr[i]); + } + else + { + sprintf(msg, "%02.2x ", ptr[i]); + } strcat(sTcpLogMsg, msg); } } #endif PROCLOGOPEN(); - PROCLOGA5("CTcpComm::ProcessBuffer - RouteMesssage pRegistry = %x id=%x len=%d len=%d\n msg=%s\n", pRegistry, msgId, fullMessageLength, rawLength, sTcpLogMsg); + PROCLOGA5("CTcpComm::ProcessBuffer - RouteMesssage pRegistry = %x id=%x len=%d len=%d msg=%s\n", pRegistry, msgId, fullMessageLength, rawLength, sTcpLogMsg); PROCLOGCLOSE(); err = pRegistry->RouteMessage(msgId, fullMessage, fullMessageLength, rawMessage, rawLength); @@ -531,17 +553,11 @@ if (bytesRemaining < protocolHeaderLength) done = true; } - else - { - numberProcessed++; - usedLen += fullMessageLength; - bytesRemaining -= fullMessageLength; - ptr += fullMessageLength; - if (bytesRemaining < protocolHeaderLength) - done = true; - } } DeleteMsg(usedLen); + PROCLOGOPEN(); + PROCLOGA2("CTcpComm::ProcessBuffer - numberSkipped=%d numberProcessed=%d\n", numberSkipped, numberProcessed); + PROCLOGCLOSE(); } }