make multiple reconnect a noop RCL_2_4
authordadubrow
Mon, 22 Feb 2010 15:31:58 -0600
branchRCL_2_4
changeset 1004 6a876b480ec4
parent 999 6d1ed1e4a715
child 1005 a584c100ba0b
make multiple reconnect a noop
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Fri Feb 19 17:02:11 2010 -0600
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/registry/Registry.java	Mon Feb 22 15:31:58 2010 -0600
@@ -673,24 +673,31 @@
 		if (!connection.isDynamic())
 			return false;
 		
+		if (!connectionToConnectedServices.containsKey(connection)) // connection does not exist
+			return false;
+		
 		// if not removed, transition out of disconnected state 
 		// return not removed
 		IConnectionStatusChangedListener listener = connectionListenerMap.remove(connection);
-		if (listener != null)
+		if (listener != null) { // is disconnected
 			connection.removeStatusChangedListener(listener);
-		if (connectionToConnectedServices.containsKey(connection)) {
-			IConnectionStatus status;
-			if (ConnectionUIUtils.isSomeServiceInUse(connection)) {
-				status = new ConnectionStatus(EConnectionStatus.IN_USE, 
-						Messages.getString("ConnectionsView.InUseLabel"), //$NON-NLS-1$
-						Messages.getString("ConnectionsView.InUseDesc")); //$NON-NLS-1$
+			if (connectionToConnectedServices.containsKey(connection)) {
+				IConnectionStatus status;
+				if (ConnectionUIUtils.isSomeServiceInUse(connection)) {
+					status = new ConnectionStatus(EConnectionStatus.IN_USE, 
+							Messages.getString("ConnectionsView.InUseLabel"), //$NON-NLS-1$
+							Messages.getString("ConnectionsView.InUseDesc")); //$NON-NLS-1$
+				}
+				else {
+					status = new ConnectionStatus(EConnectionStatus.NOT_READY, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
+				}
+				connection.setStatus(status);
+				return true;
 			}
-			else {
-				status = new ConnectionStatus(EConnectionStatus.NOT_READY, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
-			}
-			connection.setStatus(status);
+		}
+		else // connection is not disconnected
 			return true;
-		}
+		
 		return false;
 	}
 }
\ No newline at end of file