1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 06:55:23 +02:00

[284950] [dstore] Error binding socket on relaunch

This commit is contained in:
David McKnight 2011-01-20 14:35:25 +00:00
parent ec7f2b745d
commit 7887f6e631
2 changed files with 33 additions and 9 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 2009 IBM Corporation and others. * Copyright (c) 2002, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -21,6 +21,7 @@
* David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed * David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed
* David Dykstal (IBM) [235284] Cancel password change causes problem * David Dykstal (IBM) [235284] Cancel password change causes problem
* David McKnight (IBM) - [257321] [dstore] "Error binding socket" should include port of the failed socket * David McKnight (IBM) - [257321] [dstore] "Error binding socket" should include port of the failed socket
* David McKnight (IBM) - [284950] [dstore] Error binding socket on relaunch
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dstore.core.client; package org.eclipse.dstore.core.client;
@ -37,6 +38,7 @@ import java.util.ArrayList;
import javax.net.SocketFactory; import javax.net.SocketFactory;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocket;
@ -512,12 +514,23 @@ public class ClientConnection
catch (SSLHandshakeException e) catch (SSLHandshakeException e)
{ {
result = new ConnectionStatus(false, e, true, mgr.getUntrustedCerts()); result = new ConnectionStatus(false, e, true, mgr.getUntrustedCerts());
// reset port
setPort(_clientAttributes.getAttribute(DataStoreAttributes.A_HOST_PORT));
return result;
}
catch (SSLException e)
{
_theSocket.close();
// reset port
setPort(_clientAttributes.getAttribute(DataStoreAttributes.A_HOST_PORT));
result = new ConnectionStatus(false, e, true, null);
return result; return result;
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace();
_theSocket.close(); _theSocket.close();
// reset port
setPort(_clientAttributes.getAttribute(DataStoreAttributes.A_HOST_PORT));
result = new ConnectionStatus(false, e); result = new ConnectionStatus(false, e);
return result; return result;
} }
@ -589,22 +602,32 @@ public class ClientConnection
{ {
result = new ConnectionStatus(false, msg); result = new ConnectionStatus(false, msg);
_isConnected = false; _isConnected = false;
// reset port
setPort(_clientAttributes.getAttribute(DataStoreAttributes.A_HOST_PORT));
_theSocket.close(); _theSocket.close();
} }
} }
catch (java.net.ConnectException e) catch (java.net.ConnectException e)
{ {
String msg = "Connection Refused."; //$NON-NLS-1$ String msg = "Connection Refused."; //$NON-NLS-1$
// reset port
setPort(_clientAttributes.getAttribute(DataStoreAttributes.A_HOST_PORT));
msg += "\nMake sure that the DataStore server is running on " + _host + " under port " + _port + "."; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ msg += "\nMake sure that the DataStore server is running on " + _host + " under port " + _port + "."; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
result = new ConnectionStatus(false, msg); result = new ConnectionStatus(false, msg);
} }
catch (UnknownHostException uhe) catch (UnknownHostException uhe)
{ {
// reset port
setPort(_clientAttributes.getAttribute(DataStoreAttributes.A_HOST_PORT));
_isConnected = false; _isConnected = false;
result = new ConnectionStatus(_isConnected, uhe); result = new ConnectionStatus(_isConnected, uhe);
} }
catch (IOException ioe) catch (IOException ioe)
{ {
// reset port
setPort(_clientAttributes.getAttribute(DataStoreAttributes.A_HOST_PORT));
_isConnected = false; _isConnected = false;
result = new ConnectionStatus(_isConnected, ioe); result = new ConnectionStatus(_isConnected, ioe);
} }
@ -909,7 +932,6 @@ public class ClientConnection
{ {
return IDataStoreCompatibilityHandler.HANDSHAKE_UNEXPECTED; return IDataStoreCompatibilityHandler.HANDSHAKE_UNEXPECTED;
} }
} }
public boolean isKnownStatus(String status) public boolean isKnownStatus(String status)

View file

@ -40,6 +40,7 @@
* David McKnight (IBM) - [258529] Unable to display connection failure error message * David McKnight (IBM) - [258529] Unable to display connection failure error message
* David McKnight (IBM) - [306989] [dstore] workspace in strange condition if expanding projects during logon * David McKnight (IBM) - [306989] [dstore] workspace in strange condition if expanding projects during logon
* David McKnight (IBM) - [313653] [dstore] Not Secured using SSL message appears twice per connect * David McKnight (IBM) - [313653] [dstore] Not Secured using SSL message appears twice per connect
* David McKnight (IBM) - [284950] [dstore] Error binding socket on relaunch
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.connectorservice.dstore; package org.eclipse.rse.connectorservice.dstore;
@ -770,7 +771,7 @@ public class DStoreConnectorService extends StandardConnectorService implements
} }
} }
} }
if (usedSSL && connectStatus.isSLLProblem()){
// relaunching the server via the daemon so that we can connect again to the launched server with toggled useSSL settings // relaunching the server via the daemon so that we can connect again to the launched server with toggled useSSL settings
launchStatus = launchServer(clientConnection, info, daemonPort, monitor); launchStatus = launchServer(clientConnection, info, daemonPort, monitor);
if (launchStatus.isConnected()) { if (launchStatus.isConnected()) {
@ -779,6 +780,7 @@ public class DStoreConnectorService extends StandardConnectorService implements
} }
} }
} }
}
// failure to connect diagnosis - not sure why this is here since I would expect this case was already handled // failure to connect diagnosis - not sure why this is here since I would expect this case was already handled
// leaving it here just in case - will review later // leaving it here just in case - will review later