diff -r 6eab8978b7d5 -r 6c45b7c9cdac connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ConnectionImpl.cpp --- a/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ConnectionImpl.cpp Tue Jun 15 10:21:51 2010 -0500 +++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ConnectionImpl.cpp Tue Jun 15 16:19:30 2010 -0500 @@ -27,7 +27,7 @@ extern BOOL gDoLogging; #endif -//#define LOG_CONNECTION +#define LOG_CONNECTION #if defined(LOG_CONNECTION) && defined(_DEBUG) #define TCDEBUGOPEN() if (gDoLogging) { this->m_DebugLog->WaitForAccess(); } #define TCDEBUGLOGS(s) if (gDoLogging) { sprintf(this->m_DebugLogMsg,"%s", s); this->m_DebugLog->log(this->m_DebugLogMsg); } @@ -410,6 +410,7 @@ if (err == TCAPI_ERR_COMM_ERROR) { // EnterRetryPeriod(err, true, m_BaseComm->m_lastCommError); + HandleFatalPortError(err, true, m_BaseComm->m_lastCommError); m_OsError = m_BaseComm->m_lastCommError; } } @@ -662,6 +663,19 @@ return m_Registry->AddClient(client, numberIds, ids); } +long CConnectionImpl::HandleFatalPortError(long err, bool passOsErr, DWORD osErr) +{ + TCDEBUGOPEN(); + TCDEBUGLOGA3("CConnectionImpl::HandleFatalPortError err=%d passOsErr=%d osErr=%d\n", err, passOsErr, osErr); + TCDEBUGCLOSE(); + + m_BaseComm->ClosePort(); + m_Status = eDisconnected; + + NotifyClientsCommError(err); + + return TCAPI_ERR_NONE; +} void CConnectionImpl::NotifyClientsCommError(long tcfError, bool passOsError, DWORD osError) { // TCDEBUGOPEN(); @@ -769,6 +783,7 @@ { MPLOGA2("MessageProcessor err = %d osError = %d\n", err, pThis->m_BaseComm->m_lastCommError); // pThis->EnterRetryPeriod(err, true, pThis->m_BaseComm->m_lastCommError); + pThis->HandleFatalPortError(err, true, pThis->m_BaseComm->m_lastCommError); } else { @@ -786,8 +801,10 @@ if (err == TCAPI_ERR_COMM_ERROR) { + MPLOGA2("MessageProcessor err = %d osError = %d\n", err, pThis->m_BaseComm->m_lastCommError); // for this error we have os error, but we probably caught this in PollPort already // pThis->EnterRetryPeriod(err, true, pThis->m_BaseComm->m_lastCommError); + pThis->HandleFatalPortError(err, true, pThis->m_BaseComm->m_lastCommError); } else if (err != TCAPI_ERR_NONE) {