fix bug 9433 - also some logging changes
authorchpeckha
Wed, 22 Jul 2009 12:14:43 -0500
changeset 366 b054461d2f85
parent 365 666472f6d7ae
child 367 6dbcc7b15903
fix bug 9433 - also some logging changes
connectivity/com.nokia.tcf/native/TCFNative/Common/Source/TCDebugLog.cpp
connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.cpp
connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.h
connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.cpp
connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.h
connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.cpp
connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.h
connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ConnectionImpl.cpp
connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ServerManager.cpp
connectivity/com.nokia.tcf/native/TCFNative/TCFServer/TCFServer.cpp
--- a/connectivity/com.nokia.tcf/native/TCFNative/Common/Source/TCDebugLog.cpp	Thu Jul 16 09:39:55 2009 -0500
+++ b/connectivity/com.nokia.tcf/native/TCFNative/Common/Source/TCDebugLog.cpp	Wed Jul 22 12:14:43 2009 -0500
@@ -45,9 +45,9 @@
 	m_fLog = _fsopen(m_FileName, "at", _SH_DENYNO);
 
 #ifdef _DEBUG
-	FILE* f = fopen("c:\\tcf\\tcdebuglog.txt", "at");
-	fprintf(f, "name=%s m_FileName=%s\n", name, m_FileName);
-	fclose(f);
+//	FILE* f = fopen("c:\\tcf\\tcdebuglog.txt", "at");
+//	fprintf(f, "name=%s m_FileName=%s\n", name, m_FileName);
+//	fclose(f);
 #endif
 }
 TCDebugLog::~TCDebugLog()
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.cpp	Thu Jul 16 09:39:55 2009 -0500
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.cpp	Wed Jul 22 12:14:43 2009 -0500
@@ -25,7 +25,7 @@
 #include "Connection.h"
 
 #ifdef _DEBUG
-static char sLogMsg[3000];
+//static char sLogMsg[3000];
 #endif
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.h	Thu Jul 16 09:39:55 2009 -0500
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.h	Wed Jul 22 12:14:43 2009 -0500
@@ -62,6 +62,7 @@
 	HANDLE m_hSerial;
 	DCB m_dcb;
 	char m_serialPortName[MAX_COMPORT_SIZE];
+	char sLogMsg[3000];
 
 };
 
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.cpp	Thu Jul 16 09:39:55 2009 -0500
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.cpp	Wed Jul 22 12:14:43 2009 -0500
@@ -24,9 +24,6 @@
 //#include "OSTConstants.h"
 #include "Connection.h"
 
-#ifdef _DEBUG
-static char sTcpLogMsg[3000];
-#endif
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
@@ -35,9 +32,9 @@
 #ifdef _DEBUG
 	if (gDoLogging)
 	{
-		FILE* f = fopen("c:\\tcf\\tcpcommlog.txt", "at");
-		fprintf(f, "CTcpComm::CTcpComm() (default constructor)\n");
-		fclose(f);
+//		FILE* f = fopen("c:\\tcf\\tcpcommlog.txt", "at");
+//		fprintf(f, "CTcpComm::CTcpComm() (default constructor)\n");
+//		fclose(f);
 	}
 #endif
 	m_socket = INVALID_SOCKET;
@@ -45,6 +42,7 @@
 	m_timeOut.tv_usec = TIMEOUT_USEC(DEFAULT_SOCKET_TIMEOUT);
 
 	m_hSocketEvent = WSA_INVALID_EVENT;
+
 }
 
 CTcpComm::CTcpComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol)
@@ -52,9 +50,9 @@
 #ifdef _DEBUG
 	if (gDoLogging)
 	{
-		FILE* f = fopen("c:\\tcf\\tcpcommlog.txt", "at");
-		fprintf(f, "connectSettings=%x connectionId=%d, protocol=%x\n", connectSettings, connectionId, protocol);
-		fclose(f);
+//		FILE* f = fopen("c:\\tcf\\tcpcommlog.txt", "at");
+//		fprintf(f, "connectSettings=%x connectionId=%d, protocol=%x\n", connectSettings, connectionId, protocol);
+//		fclose(f);
 	}
 #endif
 	m_connId = connectionId;
@@ -75,22 +73,27 @@
 	m_timeOut.tv_usec = TIMEOUT_USEC(DEFAULT_SOCKET_TIMEOUT);
 
 	m_hSocketEvent = WSA_INVALID_EVENT;
+
 }
 CTcpComm::~CTcpComm()
 {
 #ifdef _DEBUG
 	if (gDoLogging)
 	{
-		FILE* f = fopen("c:\\tcf\\tcpcommlog.txt", "at");
-		fprintf(f, "CTcpComm::~CTcpComm()\n");
-		fclose(f);
+//		FILE* f = fopen("c:\\tcf\\tcpcommlog.txt", "at");
+//		fprintf(f, "CTcpComm::~CTcpComm()\n");
+//		fclose(f);
 	}
 #endif
 	if (IsConnected())
 	{
-		shutdown(m_socket, SD_BOTH);
-		closesocket(m_socket);
-		WSACleanup();
+		if (m_socket != INVALID_SOCKET)
+		{
+			shutdown(m_socket, SD_BOTH);
+			closesocket(m_socket);
+			WSAClose();
+		}
+		m_isConnected = false;
 	}
 	if (m_pBuffer)
 		delete[] m_pBuffer;
@@ -116,8 +119,8 @@
 
 	COMMLOGA2("CTcpComm::OpenPort ipAddress=%s ipPort=%s\n", ipAddress, ipPort);
 
-	WSADATA wsaData;
-	int wsaErr = WSAStartup(MAKEWORD(2,2), &wsaData);
+	int wsaErr = 0;
+	wsaErr = WSAInit();
 	if (wsaErr != 0)
 	{
 		err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA;
@@ -126,10 +129,12 @@
 	else
 	{
 		m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+		COMMLOGA1("CTcpComm::OpenPort socket=%x\n", m_socket);
 		if (m_socket == INVALID_SOCKET)
 		{
 			m_lastCommError = WSAGetLastError();
-			WSACleanup();
+			WSASetLastError(0);
+			WSAClose();
 			err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA;
 		}
 		else
@@ -137,25 +142,30 @@
 			if (ioctlsocket(m_socket, FIONBIO, &nonblock) == SOCKET_ERROR)
 			{
 				m_lastCommError = WSAGetLastError();
+				WSASetLastError(0);
 				closesocket(m_socket);
 				m_socket = INVALID_SOCKET;
-				WSACleanup();
+				WSAClose();
 				err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA;
 			}
 			else
 			{
 				int i = SO_MAX_MSG_SIZE;
 				// set socket options
-				BOOL keepAlive = TRUE;
+				BOOL keepAlive = FALSE;
 				setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, (const char*)&keepAlive, sizeof(BOOL));
+
+				struct linger l;
+				l.l_onoff = 0; l.l_linger = 0;
+				setsockopt(m_socket, SOL_SOCKET, SO_LINGER, (const char*)&l, sizeof(l));
+
 				int sockRecvSize = MAX_TCP_MESSAGE_BUFFER_LENGTH;//(256*1024L);
 				setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, (const char*)&sockRecvSize, sizeof(int));
 				int sockSendSize = (64*1024L);
 				setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, (const char*)&sockSendSize, sizeof(int));
 				WSAGetLastError(); // ignore error for now
-				int gotsockRecvSize, optLen=sizeof(int);
-				getsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, (char*)&gotsockRecvSize, &optLen);
-				WSAGetLastError(); // ignore error for now
+				WSASetLastError(0);
+
 				// connect
 				WORD wPort = atoi(ipPort);
 				m_clientService.sin_family = AF_INET;
@@ -164,6 +174,9 @@
 				if (connect(m_socket, (SOCKADDR*)&m_clientService, sizeof(m_clientService)) == SOCKET_ERROR)
 				{
 					int wsaErr = WSAGetLastError();
+					WSASetLastError(0);
+					COMMLOGA1("CTcpComm::OpenPort connect=wsaErr=%d\n", wsaErr);
+
 					// socket is non-blocking
 					if (wsaErr != WSAEWOULDBLOCK)
 					{
@@ -171,7 +184,7 @@
 
 						closesocket(m_socket);
 						m_socket = INVALID_SOCKET;
-						WSACleanup();
+						WSAClose();
 						err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA;
 					}
 					else // WSAEWOULDBLOCK error returned
@@ -192,6 +205,7 @@
 							if (selRes == SOCKET_ERROR)
 							{
 								wsaErr = WSAGetLastError();
+								WSASetLastError(0);
 								if (wsaErr != WSAEWOULDBLOCK)
 								{
 									// real error
@@ -199,7 +213,7 @@
 									shutdown(m_socket, SD_BOTH);
 									closesocket(m_socket);
 									m_socket = INVALID_SOCKET;
-									WSACleanup();
+									WSAClose();
 									err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA;
 								}
 								// else do another select
@@ -214,10 +228,11 @@
 							{
 								// timed out
 								m_lastCommError = WSAGetLastError();
+								WSASetLastError(0);
 								shutdown(m_socket, SD_BOTH);
 								closesocket(m_socket);
 								m_socket = INVALID_SOCKET;
-								WSACleanup();
+								WSAClose();
 								err = TCAPI_ERR_WHILE_CONFIGURING_MEDIA;
 							}
 						}
@@ -225,6 +240,7 @@
 				}
 				else // connect return OK
 				{
+					COMMLOGS("CTcpComm::OpenPort connect OK\n");
 					m_lastCommError = 0;
 					m_isConnected = true;
 				}
@@ -248,6 +264,7 @@
 #endif
 	}
 
+	COMMLOGA1("CTcpComm::OpenPort err=%d\n", err);
 	COMMLOGCLOSE();
 	return err;
 }
@@ -265,10 +282,15 @@
 	}
 	else
 	{
-		shutdown(m_socket, SD_BOTH);
-		closesocket(m_socket);
-		m_socket = INVALID_SOCKET;
-		WSACleanup();
+		if (m_socket != INVALID_SOCKET)
+		{
+			shutdown(m_socket, SD_BOTH);
+			closesocket(m_socket);
+			m_socket = INVALID_SOCKET;
+
+			WSAClose();
+		}
+		m_isConnected = false;
 
 		delete[] m_pBuffer;
 		m_pBuffer = NULL;
@@ -338,6 +360,7 @@
 		else if (selErr == SOCKET_ERROR)
 		{
 			m_lastCommError = WSAGetLastError();
+			WSASetLastError(0);
 			err = TCAPI_ERR_COMM_ERROR;
 		}
 	}
@@ -356,6 +379,7 @@
 			else // SOCKET_ERROR
 			{
 				m_lastCommError = WSAGetLastError();
+				WSASetLastError(0);
 				err = TCAPI_ERR_COMM_ERROR;
 			}
 		}
@@ -369,6 +393,7 @@
 		{
 			// SOCKET_ERROR: error on recv other than a shutdown
 			m_lastCommError = WSAGetLastError();
+			WSASetLastError(0);
 			err = TCAPI_ERR_COMM_ERROR;
 		}
 	}
@@ -392,6 +417,7 @@
 		if (res == SOCKET_ERROR)
 		{
 			long commErr = WSAGetLastError();
+			WSASetLastError(0);
 			if ((DWORD)commErr != m_lastCommError)
 			{
 				m_lastCommError = commErr;
@@ -414,6 +440,7 @@
 	{
 		// SOCKET_ERROR on ioctlsocket
 		m_lastCommError = WSAGetLastError();
+		WSASetLastError(0);
 		err = TCAPI_ERR_COMM_ERROR;
 	}
 	return err;
@@ -552,6 +579,7 @@
 		{
 			err = TCAPI_ERR_COMM_ERROR;
 			m_lastCommError = sockErr;
+			COMMLOGA1("CTcpComm::SendDataToPort getsockopt=%d\n", sockErr);
 			COMMLOGCLOSE();
 			return err;
 		}
@@ -580,11 +608,15 @@
 		else if (selErr == SOCKET_ERROR)
 		{
 			m_lastCommError = WSAGetLastError();
+			WSASetLastError(0);
+			COMMLOGA1("CTcpComm::SendDataToPort select(SOCKET_ERROR)=%d\n", m_lastCommError);
 			err = TCAPI_ERR_COMM_ERROR;
 		}
 		else if (selErr == 0) // timeout
 		{
 			m_lastCommError = WSAGetLastError();
+			WSASetLastError(0);
+			COMMLOGA1("CTcpComm::SendDataToPort select(timeout)=%d\n", m_lastCommError);
 			err = TCAPI_ERR_COMM_ERROR;
 		}
 	}
@@ -602,10 +634,12 @@
 			if (nSent == SOCKET_ERROR)
 			{
 				int wsaErr = WSAGetLastError();
+				WSASetLastError(0);
 				// ignore "would block" errors
 				if (wsaErr != WSAEWOULDBLOCK)
 				{
 					// TODO: error handling
+					COMMLOGA1("CTcpComm::SendDataToPort send(SOCKET_ERROR)=%d\n", wsaErr);
 					m_lastCommError = wsaErr;
 					err = TCAPI_ERR_COMM_ERROR;
 					break;
@@ -653,14 +687,47 @@
 }
 bool CTcpComm::IsConnectionEqual(ConnectData* pConn)
 {
-	if ((strcmp(pConn->tcpSettings.ipAddress, m_ConnectSettings->tcpSettings.ipAddress) == 0) &&
-		(strcmp(pConn->tcpSettings.ipPort, m_ConnectSettings->tcpSettings.ipPort) == 0))
+	if ((strcmp(pConn->tcpSettings.ipAddress, m_ConnectSettings->tcpSettings.ipAddress) == 0))
 	{
-		return true;
+		if ((strcmp(pConn->tcpSettings.ipPort, m_ConnectSettings->tcpSettings.ipPort) == 0))
+		{
+			// same port and same IP
+			return true;
+		}
+		else
+		{
+			// different port but same IP
+			return false;
+		}
 	}
 	else
 	{
+		// different IP
 		return false;
 	}
 }
 
+int CTcpComm::WSAInit() 
+{
+	int wsaErr = 0;
+
+	COMMLOGOPEN();
+	COMMLOGS("CTcpComm::WSAInit\n");
+
+	WSADATA wsaData;
+	wsaErr = WSAStartup(MAKEWORD(2,2), &wsaData);
+
+	COMMLOGCLOSE();
+	return wsaErr;
+}
+
+void CTcpComm::WSAClose()
+{
+	COMMLOGOPEN();
+	COMMLOGS("CTcpComm::WSAClose\n");
+
+	WSACleanup();
+
+	COMMLOGCLOSE();
+}
+
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.h	Thu Jul 16 09:39:55 2009 -0500
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TcpComm.h	Wed Jul 22 12:14:43 2009 -0500
@@ -56,6 +56,9 @@
 	virtual long PreProcessMessage(int inMsgType, DWORD inMsgLength, BYTE* inMessage) { return TCAPI_ERR_NONE; }
 	virtual long PreProcessMessage(BYTE msgId, DWORD inMsgLength, BYTE* inMessage) { return TCAPI_ERR_NONE; }
 	bool IsConnectionEqual(ConnectData* pConn);
+	int WSAInit();
+	void WSAClose();
+
 
 private:
 	SOCKET m_socket;
@@ -63,7 +66,7 @@
 	TIMEVAL m_timeOut;
 	WSAEVENT m_hSocketEvent; 
 	DWORD m_pPeekBuffer;
-
+	char sTcpLogMsg[3000];
 };
 
 #endif // !defined(AFX_TCPCOMM_H__69657421_6D37_497A_A377_12E71365EDAB__INCLUDED_)
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.cpp	Thu Jul 16 09:39:55 2009 -0500
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.cpp	Wed Jul 22 12:14:43 2009 -0500
@@ -23,9 +23,9 @@
 #ifdef _DEBUG
 	if (gDoLogging)
 	{
-		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
-		fprintf(f, "CBaseCom::CBaseCom() (default constructor)\n");
-		fclose(f);
+//		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
+//		fprintf(f, "CBaseCom::CBaseCom() (default constructor)\n");
+//		fclose(f);
 	}
 #endif
 	m_isConnected = false;
@@ -44,9 +44,9 @@
 #ifdef _DEBUG
 	if (gDoLogging)
 	{
-		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
-		fprintf(f, "connectSettings=%x connectionId=%d, protocol=%x\n", connectSettings, connectionId, protocol);
-		fclose(f);
+//		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
+//		fprintf(f, "connectSettings=%x connectionId=%d, protocol=%x\n", connectSettings, connectionId, protocol);
+//		fclose(f);
 	}
 #endif
 	m_isConnected = false;
@@ -63,11 +63,19 @@
 	m_ConnectSettings = new ConnectData();
 	memcpy(m_ConnectSettings, connectSettings, sizeof(ConnectData));
 
-#if (defined(LOG_COMM) || defined(LOG_PROCCOMM)) && defined(_DEBUG)
+#if defined(_DEBUG)
 	if (gDoLogging)
 	{
+#if defined(LOG_COMM)
 		m_CommDebugLog = new TCDebugLog("TCF_Comm", connectionId, 2000L);
+#else
+		m_CommDebugLog = NULL;
+#endif
+#if defined(LOG_PROCCOMM)
 		m_ProcDebugLog = new TCDebugLog("TCF_CommP", connectionId, 2000L);
+#else
+		m_ProcDebugLog = NULL;
+#endif
 	}
 #endif
 }
@@ -77,9 +85,9 @@
 #ifdef _DEBUG
 	if (gDoLogging)
 	{
-		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
-		fprintf(f, "CBaseCom::~CBaseCom()\n");
-		fclose(f);
+//		FILE* f = fopen("c:\\tcf\\basecommlog.txt", "at");
+//		fprintf(f, "CBaseCom::~CBaseCom()\n");
+//		fclose(f);
 	}
 #endif
 	if (m_pBuffer)
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.h	Thu Jul 16 09:39:55 2009 -0500
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseCom.h	Wed Jul 22 12:14:43 2009 -0500
@@ -48,7 +48,7 @@
 #define COMMLOGCLOSE()
 #endif
 
-#define LOG_PROCCOMM
+//#define LOG_PROCCOMM
 #if defined(LOG_PROCCOMM) && defined(_DEBUG)
 #define PROCLOGOPEN() if (gDoLogging) { m_ProcDebugLog->WaitForAccess(); }
 #define PROCLOGS(s) if (gDoLogging) { sprintf(m_ProcDebugLogMsg,"%s", s); m_ProcDebugLog->log(m_ProcDebugLogMsg); }
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ConnectionImpl.cpp	Thu Jul 16 09:39:55 2009 -0500
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ConnectionImpl.cpp	Wed Jul 22 12:14:43 2009 -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); }
@@ -46,6 +46,8 @@
 #define TCDEBUGCLOSE()
 #endif
 
+//#define LOG_MPROCESSOR
+
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
@@ -84,8 +86,16 @@
 #ifdef _DEBUG
 	if (gDoLogging)
 	{
+#if defined(LOG_CONNECTION)
 		m_DebugLog = new TCDebugLog("TCF_ConnectionLog", connectionId);
+#else
+		m_DebugLog = NULL;
+#endif
+#if defined(LOG_MPROCESSOR)
 		m_DebugLog2 = new TCDebugLog("TCF_ProcessorLog", connectionId);
+#else
+		m_DebugLog2 = NULL;
+#endif
 	}
 	else
 	{
@@ -394,7 +404,7 @@
 		TCDEBUGLOGS("CConnectionImpl::DoSendMessage done\n");
 		if (err == TCAPI_ERR_COMM_ERROR)
 		{
-			EnterRetryPeriod(err, true, m_BaseComm->m_lastCommError);
+//			EnterRetryPeriod(err, true, m_BaseComm->m_lastCommError);
 			m_OsError = m_BaseComm->m_lastCommError;
 		}
 	}
@@ -493,7 +503,7 @@
 long CConnectionImpl::EnterRetryPeriod(long commErr, bool passOsErr, DWORD osErr)
 {
 	TCDEBUGOPEN();
-	TCDEBUGLOGS("CConnectionImpl::EnterRetryPeriod\n");
+	TCDEBUGLOGA3("CConnectionImpl::EnterRetryPeriod commErr=%d passOsErr=%d osErr=%d\n", commErr, passOsErr, osErr);
 	TCDEBUGCLOSE();
 
 	long err = TCAPI_ERR_NONE;
@@ -700,7 +710,6 @@
 	}
 }
 
-#define LOG_MPROCESSOR
 #if defined(LOG_MPROCESSOR) && defined(_DEBUG)
 #define MPLOGOPEN() if (gDoLogging) { pThis->m_DebugLog2->WaitForAccess(); }
 #define MPLOGS(s) if (gDoLogging) { sprintf(pThis->m_DebugLogMsg2,"%s", s); pThis->m_DebugLog2->log(pThis->m_DebugLogMsg2); }
@@ -754,7 +763,7 @@
 				if (err != TCAPI_ERR_NONE)
 				{
 					MPLOGA2("MessageProcessor  err = %d osError = %d\n", err, pThis->m_BaseComm->m_lastCommError);
-					pThis->EnterRetryPeriod(err, true, pThis->m_BaseComm->m_lastCommError);
+//					pThis->EnterRetryPeriod(err, true, pThis->m_BaseComm->m_lastCommError);
 				}
 				else
 				{
@@ -773,7 +782,7 @@
 						if (err == TCAPI_ERR_COMM_ERROR)
 						{
 							// 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->EnterRetryPeriod(err, true, pThis->m_BaseComm->m_lastCommError);
 						}
 						else if (err != TCAPI_ERR_NONE)
 						{
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ServerManager.cpp	Thu Jul 16 09:39:55 2009 -0500
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ServerManager.cpp	Wed Jul 22 12:14:43 2009 -0500
@@ -28,7 +28,7 @@
 extern BOOL gDoLogging;
 #endif
 
-#define LOG_SERVERMANAGER
+//#define LOG_SERVERMANAGER
 #if defined(LOG_SERVERMANAGER) && defined(_DEBUG)
 extern char TCDebugMsg[];
 #define TCDEBUGOPEN() if (gDoLogging) { m_DebugLog->WaitForAccess(); }
@@ -66,7 +66,7 @@
 }
 CServerManager::CServerManager(const char* exeLocation)
 {
-#ifdef _DEBUG
+#if defined(LOG_SERVERMANAGER) && defined(_DEBUG)
 	if (gDoLogging)
 		m_DebugLog = new TCDebugLog("TCF_ServerLog", ::GetCurrentProcessId());
 	else
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/TCFServer.cpp	Thu Jul 16 09:39:55 2009 -0500
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFServer/TCFServer.cpp	Wed Jul 22 12:14:43 2009 -0500
@@ -75,15 +75,16 @@
 #ifdef _DEBUG
 	if (gDoLogging)
 	{
-		FILE* f = fopen("c:\\tcf\\TCFServer_Main.txt", "at");
-		LogTime(f);
-		fprintf(f,"ExeLocation=%s\n", gServerLocation);
-		fclose(f);
+//		FILE* f = fopen("c:\\tcf\\TCFServer_Main.txt", "at");
+//		LogTime(f);
+//		fprintf(f,"ExeLocation=%s\n", gServerLocation);
+//		fclose(f);
 	}
 #endif
 	gManager = new CServerManager(gServerLocation);
 	gManager->CommandThread();
 	delete gManager;
+
 	return 0;
 }
 #ifdef _DEBUG