Fix TCFServer life-cycle issues bug 10621
authorChad Peckham <chad.peckham@nokia.com>
Wed, 10 Feb 2010 13:33:18 -0600
changeset 914 46f36a149510
parent 910 b142ab8c7bbd
child 924 657e34ac671f
Fix TCFServer life-cycle issues bug 10621
connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ClientManager.cpp
connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ClientManager.h
connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCAPIConnectionJni.cpp
connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.plg
connectivity/com.nokia.tcf/native/TCFNative/TCFNative.ncb
connectivity/com.nokia.tcf/native/TCFNative/TCFNative.opt
connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCAPIConnection.java
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ClientManager.cpp	Tue Feb 09 08:09:33 2010 -0600
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ClientManager.cpp	Wed Feb 10 13:33:18 2010 -0600
@@ -488,7 +488,32 @@
 	TCDEBUGLOGA1("CClientManager::StartServer end numRefs = %d\n", pData->numRefs);
 	return ret;
 }
-
+BOOL CClientManager::IsTCFServerActive(DWORD processId)
+{
+	HANDLE h = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, processId);
+	if (h)
+	{
+		// is it really still alive?
+		DWORD exitCode = -5;
+		BOOL exitCall = ::GetExitCodeProcess(h, &exitCode);
+		::CloseHandle(h);
+		if (exitCall == TRUE && exitCode != STILL_ACTIVE)
+		{
+			// TCFServer is really dead
+			return FALSE;
+		}
+		else
+		{
+			// TCFServer is still active
+			return TRUE;
+		}
+	}
+	else
+	{
+		// TCFServer is really dead
+		return FALSE;
+	}
+}
 long CClientManager::StopServer()
 {
 	long ret = TCAPI_ERR_NONE;
@@ -516,23 +541,34 @@
 		// substract ref count
 		pData->numRefs--;
 		if (pData->numRefs < 0) pData->numRefs = 0;
+
+		bool sendStop = true;
+		if (!IsTCFServerActive(pData->serverProcess.dwProcessId))
+		{
+			sendStop = false;
+			pData->numRefs = 0;
+		}
+
 		// if refcount == 0 then really stop the server process
 		if (pData->numRefs == 0)
 		{
-			// last client process is closing
-			// tell server to exit
-			ServerCommandData cmdrsp;
-			cmdrsp.command = eCmdExit;
-			
-			TCDEBUGLOGS(" SendCommand eCmdExit\n");
-			m_Server->SendCommand(&cmdrsp);
-			TCDEBUGLOGS(" GetResponse eExit\n");
-			m_Server->GetResponse(&cmdrsp);
-			
-			// wait for process to exit
-			TCDEBUGLOGS(" WaitForSingleObject start\n");
-			DWORD waitErr = ::WaitForSingleObject(m_hServer, 10000L /*INFINITE*/);
-			TCDEBUGLOGA1("CClientManager::StopServer WaitForSingleObject = %d\n", waitErr);
+			if (sendStop)
+			{
+				// last client process is closing
+				// tell server to exit
+				ServerCommandData cmdrsp;
+				cmdrsp.command = eCmdExit;
+				
+				TCDEBUGLOGS(" SendCommand eCmdExit\n");
+				m_Server->SendCommand(&cmdrsp);
+				TCDEBUGLOGS(" GetResponse eExit\n");
+				m_Server->GetResponse(&cmdrsp);
+				
+				// wait for process to exit
+				TCDEBUGLOGS(" WaitForSingleObject start\n");
+				DWORD waitErr = ::WaitForSingleObject(m_hServer, 10000L /*INFINITE*/);
+				TCDEBUGLOGA1("CClientManager::StopServer WaitForSingleObject = %d\n", waitErr);
+			}
 
 			// now close our handle to server process
 			if (m_hServer != NULL)
@@ -580,11 +616,14 @@
 BOOL CClientManager::IsServerRunning()
 {
 	pServerProcessData pData = m_Server->GetProcessPtr();
-	if (pData->serverProcess.hProcess != NULL)
+	if (IsTCFServerActive(pData->serverProcess.dwProcessId))
+	{
 		return TRUE;
+	}
 	else
+	{
 		return FALSE;
-
+	}
 }
 
 void CClientManager::CreateLockFile(DWORD processId)
@@ -780,6 +819,7 @@
 				}
 				if (numDeadCallers == numIds)
 				{
+					// All clients of this TCFServer are dead
 					// terminate the TCFServer, and delete lock file
 					pData->numRefs = 0;
 					::remove(m_ServerLockFile);
@@ -797,27 +837,43 @@
 				}
 				else
 				{
-					// leave TCFServer running, recreate lock file and save live callers
-					::remove(m_ServerLockFile);
-					f = fopen(m_ServerLockFile, "wt");
-					if (f)
+					// some java clients are still alive
+					//   check to see if TCFServer is still alive
+					if (IsTCFServerActive(serverIds[0]))
 					{
-						for (int i = 0; i < numIds; i++)
+						// TCFServer is still active
+						// leave TCFServer running, recreate lock file and save live callers
+						::remove(m_ServerLockFile);
+						f = fopen(m_ServerLockFile, "wt");
+						if (f)
 						{
-							if (liveCaller[i])
+							for (int i = 0; i < numIds; i++)
 							{
-								fprintf(f, "%ld %ld\n", creatorIds[i], serverIds[i]);
+								if (liveCaller[i])
+								{
+									fprintf(f, "%ld %ld\n", creatorIds[i], serverIds[i]);
+								}
 							}
+							fclose(f);
 						}
-						fclose(f);
+						pData->numRefs -= numDeadCallers;
+						if (pData->numRefs < 0) pData->numRefs = 0;
 					}
-					pData->numRefs -= numDeadCallers;
-					if (pData->numRefs < 0) pData->numRefs = 0;
+					else
+					{
+						// TCFServer is really dead
+						pData->numRefs = 0;
+						::remove(m_ServerLockFile);
+					}
 				}
 			}
 			else
 			{
 				// error opening lock file
+				// perhaps the user deleted it,
+				//   if so, we assume he has also deleted the TCFServer as we now have no way of verifying if the 
+				//   process is dead.
+				pData->numRefs = 0;
 				DWORD err = ::GetLastError();
 				TCDEBUGLOGA2("CClientManager::TerminateServerThroughLockFile fopenErr=%d:%s\n", err, GetErrorText(err));
 			}
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ClientManager.h	Tue Feb 09 08:09:33 2010 -0600
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/ClientManager.h	Wed Feb 10 13:33:18 2010 -0600
@@ -70,6 +70,7 @@
 	void AppendToLockFile(DWORD processId);
 	void DeleteLockFile();
 	void DeleteFromLockFile(DWORD processId);
+	BOOL IsTCFServerActive(DWORD processId);
 
 	// input stream
 	CInputStream* FindInputStream(long inClientId);
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCAPIConnectionJni.cpp	Tue Feb 09 08:09:33 2010 -0600
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCAPIConnectionJni.cpp	Wed Feb 10 13:33:18 2010 -0600
@@ -84,6 +84,13 @@
 	TCDEBUGOPEN();
 
 	TCDEBUGLOGS("nativeConnect\n");
+	if (!gManager->IsServerRunning())
+	{
+		TCDEBUGLOGS("Server not running\n");
+		TCDEBUGCLOSE();
+		return TCAPI_ERR_COMM_SERVER_RESPONSE_TIMEOUT;
+	}
+
 
 	gManager->m_Server->WaitforServerPipeAccess();
 
@@ -1255,6 +1262,13 @@
 	TCDEBUGOPEN();
 	TCDEBUGLOGS("nativeSendMessage\n");
 	TCDEBUGLOGA1(" inClientId=%d\n", inClientId);
+	if (!gManager->IsServerRunning())
+	{
+		// return right away if TCFServer is dead
+		TCDEBUGLOGS("nativeSendMessage: server is dead\n");
+		TCDEBUGCLOSE();
+		return TCAPI_ERR_COMM_SERVER_RESPONSE_TIMEOUT;
+	}
 
 	gManager->m_Server->WaitforServerPipeAccess();
 
--- a/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.plg	Tue Feb 09 08:09:33 2010 -0600
+++ b/connectivity/com.nokia.tcf/native/TCFNative/TCFClient/TCFClient.plg	Wed Feb 10 13:33:18 2010 -0600
@@ -3,72 +3,117 @@
 <pre>
 <h1>Build Log</h1>
 <h3>
---------------------Configuration: TCFClient - Win32 Release--------------------
+--------------------Configuration: TCFCommSerial - Win32 Release--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating command line "rc.exe /l 0x409 /fo"Release/resource.res" /d "NDEBUG" "C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFClient\resource.rc"" 
-Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSPC0.tmp" with contents
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP60C.tmp" with contents
 [
-/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"Release/TCFClient.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFClient\ClientManager.cpp"
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\ErrorMonitorData.cpp"
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\InputStream.cpp"
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp"
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\ServerClient.cpp"
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\shareddata.cpp"
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFClient\TCAPIConnectionJni.cpp"
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp"
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFClient\TCFClient.cpp"
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFClient\TCFCppApi.cpp"
-]
-Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSPC0.tmp" 
-Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSPC1.tmp" with contents
-[
-/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I ".\jdk1.5.0_10\include" /I ".\jdk1.5.0_10\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCLIENT_EXPORTS" /Fp"Release/TCFClient.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
-"C:\dev22clone\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFClient\StdAfx.cpp"
+/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Fp"Release/TCFCommSerial.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\BaseCom.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFCommSerial\RealSerialComm.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFCommSerial\TCFCommSerial.cpp"
 ]
-Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSPC1.tmp" 
-Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSPC2.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP60C.tmp" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP60D.tmp" with contents
 [
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib shlwapi.lib /nologo /dll /incremental:no /pdb:"Release/TCFClient.pdb" /map:"Release/TCFClient.map" /machine:I386 /out:"Release/TCFClient.dll" /implib:"Release/TCFClient.lib" 
-.\Release\ClientManager.obj
-.\Release\ErrorMonitorData.obj
-.\Release\InputStream.obj
+/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMSERIAL_EXPORTS" /Fp"Release/TCFCommSerial.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFCommSerial\StdAfx.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP60D.tmp" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP60E.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"Release/TCFCommSerial.pdb" /map:"Release/TCFCommSerial.map" /machine:I386 /out:"Release/TCFCommSerial.dll" /implib:"Release/TCFCommSerial.lib" 
+.\Release\BaseCom.obj
 .\Release\mutex.obj
-.\Release\ServerClient.obj
-.\Release\shareddata.obj
+.\Release\RealSerialComm.obj
 .\Release\StdAfx.obj
-.\Release\TCAPIConnectionJni.obj
 .\Release\TCDebugLog.obj
-.\Release\TCFClient.obj
-.\Release\TCFCppApi.obj
-.\Release\resource.res
+.\Release\TCFCommSerial.obj
 ]
-Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSPC2.tmp"
+Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP60E.tmp"
 <h3>Output Window</h3>
-Compiling resources...
 Compiling...
 StdAfx.cpp
 Compiling...
-ClientManager.cpp
-ErrorMonitorData.cpp
-InputStream.cpp
+BaseCom.cpp
 mutex.cpp
-ServerClient.cpp
-shareddata.cpp
-TCAPIConnectionJni.cpp
+RealSerialComm.cpp
 TCDebugLog.cpp
-TCFClient.cpp
-TCFCppApi.cpp
+TCFCommSerial.cpp
 Generating Code...
 Linking...
-   Creating library Release/TCFClient.lib and object Release/TCFClient.exp
-Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSPC6.bat" with contents
+   Creating library Release/TCFCommSerial.lib and object Release/TCFCommSerial.exp
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP612.bat" with contents
+[
+@echo off
+copyBinaries Release
+]
+Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP612.bat"
+copy libs
+Copy binaries to ..\..\..\os\win32\x86
+The system cannot find the path specified.
+        0 file(s) copied.
+The system cannot find the path specified.
+        0 file(s) copied.
+The system cannot find the path specified.
+        0 file(s) copied.
+Error executing c:\winnt\system32\cmd.exe.
+
+
+
+<h3>Results</h3>
+TCFCommSerial.dll - 1 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: TCFCommTCP - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP613.tmp" with contents
+[
+/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /Fp"Release/TCFCommTCP.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\BaseCom.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFCommTCP\TCFCommTCP.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFCommTCP\TcpComm.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP613.tmp" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP614.tmp" with contents
+[
+/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /I "..\Common\Headers" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMTCP_EXPORTS" /Fp"Release/TCFCommTCP.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFCommTCP\StdAfx.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP614.tmp" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP615.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib shlwapi.lib /nologo /dll /incremental:no /pdb:"Release/TCFCommTCP.pdb" /map:"Release/TCFCommTCP.map" /machine:I386 /out:"Release/TCFCommTCP.dll" /implib:"Release/TCFCommTCP.lib" 
+.\Release\BaseCom.obj
+.\Release\mutex.obj
+.\Release\StdAfx.obj
+.\Release\TCDebugLog.obj
+.\Release\TCFCommTCP.obj
+.\Release\TcpComm.obj
+]
+Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP615.tmp"
+<h3>Output Window</h3>
+Compiling...
+StdAfx.cpp
+Compiling...
+BaseCom.cpp
+mutex.cpp
+TCDebugLog.cpp
+TCFCommTCP.cpp
+TcpComm.cpp
+Generating Code...
+Linking...
+   Creating library Release/TCFCommTCP.lib and object Release/TCFCommTCP.exp
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP619.bat" with contents
 [
 @echo off
 copybinaries Release
 ]
-Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSPC6.bat"
+Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP619.bat"
 copy libs
 Copy binaries to ..\..\..\os\win32\x86
 The system cannot find the path specified.
@@ -82,7 +127,224 @@
 
 
 <h3>Results</h3>
-TCFClient.dll - 1 error(s), 0 warning(s)
+TCFCommTCP.dll - 1 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: TCFCommVirtualSerial - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP61A.tmp" with contents
+[
+/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Fp"Release/TCFCommVirtualSerial.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\BaseCom.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFCommSerial\RealSerialComm.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFCommVirtualSerial\TCFCommVirtualSerial.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFCommVirtualSerial\VirtualSerialComm.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP61A.tmp" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP61B.tmp" with contents
+[
+/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFCommSerial" /I "..\Common\Headers" /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFCOMMVIRTUALSERIAL_EXPORTS" /Fp"Release/TCFCommVirtualSerial.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFCommVirtualSerial\StdAfx.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP61B.tmp" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP61C.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"Release/TCFCommVirtualSerial.pdb" /map:"Release/TCFCommVirtualSerial.map" /machine:I386 /out:"Release/TCFCommVirtualSerial.dll" /implib:"Release/TCFCommVirtualSerial.lib" 
+.\Release\BaseCom.obj
+.\Release\mutex.obj
+.\Release\RealSerialComm.obj
+.\Release\StdAfx.obj
+.\Release\TCDebugLog.obj
+.\Release\TCFCommVirtualSerial.obj
+.\Release\VirtualSerialComm.obj
+]
+Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP61C.tmp"
+<h3>Output Window</h3>
+Compiling...
+StdAfx.cpp
+Compiling...
+BaseCom.cpp
+mutex.cpp
+RealSerialComm.cpp
+TCDebugLog.cpp
+TCFCommVirtualSerial.cpp
+VirtualSerialComm.cpp
+Generating Code...
+Linking...
+   Creating library Release/TCFCommVirtualSerial.lib and object Release/TCFCommVirtualSerial.exp
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP620.bat" with contents
+[
+@echo off
+copyBinaries Release
+]
+Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP620.bat"
+copy libs
+Copy binaries to ..\..\..\os\win32\x86
+The system cannot find the path specified.
+        0 file(s) copied.
+The system cannot find the path specified.
+        0 file(s) copied.
+The system cannot find the path specified.
+        0 file(s) copied.
+Error executing c:\winnt\system32\cmd.exe.
+
+
+
+<h3>Results</h3>
+TCFCommVirtualSerial.dll - 1 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: TCFProtOST - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP621.tmp" with contents
+[
+/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Fp"Release/TCFProtOST.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\BaseProtocol.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFProtOST\OSTProtocol.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFProtOST\TCFProtOST.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP621.tmp" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP622.tmp" with contents
+[
+/nologo /Zp2 /MT /W3 /GX /O2 /I "..\TCFServer" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCFPROTOST_EXPORTS" /Fp"Release/TCFProtOST.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFProtOST\StdAfx.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP622.tmp" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP623.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"Release/TCFProtOST.pdb" /map:"Release/TCFProtOST.map" /machine:I386 /out:"Release/TCFProtOST.dll" /implib:"Release/TCFProtOST.lib" 
+.\Release\BaseProtocol.obj
+.\Release\OSTProtocol.obj
+.\Release\StdAfx.obj
+.\Release\TCFProtOST.obj
+]
+Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP623.tmp"
+<h3>Output Window</h3>
+Compiling...
+StdAfx.cpp
+Compiling...
+BaseProtocol.cpp
+OSTProtocol.cpp
+TCFProtOST.cpp
+Generating Code...
+Linking...
+   Creating library Release/TCFProtOST.lib and object Release/TCFProtOST.exp
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP627.bat" with contents
+[
+@echo off
+copyBinaries Release
+]
+Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP627.bat"
+copy libs
+Copy binaries to ..\..\..\os\win32\x86
+The system cannot find the path specified.
+        0 file(s) copied.
+The system cannot find the path specified.
+        0 file(s) copied.
+The system cannot find the path specified.
+        0 file(s) copied.
+Error executing c:\winnt\system32\cmd.exe.
+
+
+
+<h3>Results</h3>
+TCFProtOST.dll - 1 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: TCFServer - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating command line "rc.exe /l 0x409 /fo"Release/resource.res" /d "NDEBUG" "C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\resource.rc"" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP628.tmp" with contents
+[
+/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I "..\Common\Source" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Release/TCFServer.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\Client.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\CommRegistryItem.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\Connection.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\ConnectionImpl.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\ErrorMonitorData.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\InputStream.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\MessageFile.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\mutex.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\ProtocolRegistryItem.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\Registry.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\RegistryImpl.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\ServerClient.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\ServerManager.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\shareddata.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\Common\Source\TCDebugLog.cpp"
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\TCFServer.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP628.tmp" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP629.tmp" with contents
+[
+/nologo /Zp2 /MT /W3 /GX /O2 /I "..\Common\Headers" /I "..\Common\Source" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Release/TCFServer.pch" /Yc"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 
+"C:\dev22clone2\carbidecpp\connectivity\com.nokia.tcf\native\TCFNative\TCFServer\StdAfx.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP629.tmp" 
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP62A.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib shlwapi.lib /nologo /subsystem:console /incremental:no /pdb:"Release/TCFServer.pdb" /machine:I386 /out:"Release/TCFServer.exe" 
+.\Release\Client.obj
+.\Release\CommRegistryItem.obj
+.\Release\Connection.obj
+.\Release\ConnectionImpl.obj
+.\Release\ErrorMonitorData.obj
+.\Release\InputStream.obj
+.\Release\MessageFile.obj
+.\Release\mutex.obj
+.\Release\ProtocolRegistryItem.obj
+.\Release\Registry.obj
+.\Release\RegistryImpl.obj
+.\Release\ServerClient.obj
+.\Release\ServerManager.obj
+.\Release\shareddata.obj
+.\Release\StdAfx.obj
+.\Release\TCDebugLog.obj
+.\Release\TCFServer.obj
+.\Release\resource.res
+]
+Creating command line "link.exe @C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP62A.tmp"
+<h3>Output Window</h3>
+Compiling resources...
+Compiling...
+StdAfx.cpp
+Compiling...
+Client.cpp
+CommRegistryItem.cpp
+Connection.cpp
+ConnectionImpl.cpp
+ErrorMonitorData.cpp
+InputStream.cpp
+MessageFile.cpp
+mutex.cpp
+ProtocolRegistryItem.cpp
+Registry.cpp
+RegistryImpl.cpp
+ServerClient.cpp
+ServerManager.cpp
+shareddata.cpp
+TCDebugLog.cpp
+TCFServer.cpp
+Generating Code...
+Linking...
+Creating temporary file "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP62C.bat" with contents
+[
+@echo off
+copybinaries Release
+]
+Creating command line "C:\DOCUME~1\chpeckha\LOCALS~1\Temp\RSP62C.bat"
+copy binary
+Copy binaries to ..\..\..\os\win32\x86
+The system cannot find the path specified.
+        0 file(s) copied.
+Error executing c:\winnt\system32\cmd.exe.
+
+
+
+<h3>Results</h3>
+TCFServer.exe - 1 error(s), 0 warning(s)
 </pre>
 </body>
 </html>
Binary file connectivity/com.nokia.tcf/native/TCFNative/TCFNative.ncb has changed
Binary file connectivity/com.nokia.tcf/native/TCFNative/TCFNative.opt has changed
--- a/connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCAPIConnection.java	Tue Feb 09 08:09:33 2010 -0600
+++ b/connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCAPIConnection.java	Wed Feb 10 13:33:18 2010 -0600
@@ -359,6 +359,23 @@
 				this.cookie.setConnected(true);
 				this.connection = inConnection;
 				this.messageOptions = inMessageOptions;
+			} else if (ret == TCErrorConstants.TCAPI_ERR_COMM_SERVER_RESPONSE_TIMEOUT){
+				// TCFServer may have died, attempt to restart it
+				ret = nativeStartServer();
+				if (ret == TCErrorConstants.TCAPI_ERR_NONE) {
+					// now try connecting again
+					ret = nativeConnect(type, options, settings, moptions, filePath, clientId);
+					if (ret == TCErrorConstants.TCAPI_ERR_NONE) {
+						this.cookie.setClientId(clientId[0]);
+						this.cookie.setConnected(true);
+						this.connection = inConnection;
+						this.messageOptions = inMessageOptions;
+					} else {
+						status = new Status(Status.ERROR, Activator.PLUGIN_ID, (int)ret, TCErrorConstants.getErrorMessage(ret), null);
+					}
+				} else {
+					status = new Status(Status.ERROR, Activator.PLUGIN_ID, (int)ret, TCErrorConstants.getErrorMessage(ret), null);
+				}
 			} else {
 				status = new Status(Status.ERROR, Activator.PLUGIN_ID, (int)ret, TCErrorConstants.getErrorMessage(ret), null);
 			}