connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCAPIConnection.java
changeset 914 46f36a149510
parent 665 12ea338ad1f6
child 1556 707b5fa4c143
--- 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);
 			}