Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Given the use case, I think it's simpler to just define one option
instead of two.
  • Loading branch information
kohsuke committed Apr 25, 2013
1 parent 7cc8329 commit d1ccc5b
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/main/java/hudson/remoting/Launcher.java
Expand Up @@ -160,7 +160,7 @@ public void setConnectTo(String target) {
*/
@Option(name="-noCertificateCheck")
public void setNoCertificateCheck(boolean _) throws NoSuchAlgorithmException, KeyManagementException {
System.out.println("Skipping HTTPS certificate checks altoghether. Note that this is not secure at all.");
System.out.println("Skipping HTTPS certificate checks altogether. Note that this is not secure at all.");
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, new TrustManager[]{new NoCheckTrustManager()}, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
Expand All @@ -172,11 +172,8 @@ public boolean verify(String s, SSLSession sslSession) {
});
}

@Option(name="-noReconnectJnlp",usage="Doesn't try to reconnect when fetch JNLP")
public boolean noReconnectJnlp = false;

@Option(name="-noReconnectAgent",usage="Doesn't try to reconnect by JNLP slave agent")
public boolean noReconnectAgent = false;
@Option(name="-noReconnect",usage="Doesn't try to reconnect when a communication fail, and exit instead")
public boolean noReconnect = false;

public static void main(String... args) throws Exception {
Launcher launcher = new Launcher();
Expand Down Expand Up @@ -211,8 +208,7 @@ public void run() throws Exception {
} else
if(slaveJnlpURL!=null) {
List<String> jnlpArgs = parseJnlpArguments();
if ( this.noReconnectAgent )
{
if (this.noReconnect) {
jnlpArgs.add("-noreconnect");
}
try {
Expand Down Expand Up @@ -316,12 +312,11 @@ public List<String> parseJnlpArguments() throws ParserConfigurationException, SA
} else
throw e;
} catch (IOException e) {
if (this.noReconnect)
throw (IOException)new IOException("Failing to obtain "+slaveJnlpURL).initCause(e);

System.err.println("Failing to obtain "+slaveJnlpURL);
e.printStackTrace(System.err);
if ( this.noReconnectJnlp )
{
throw e;
}
System.err.println("Waiting 10 seconds before retry");
Thread.sleep(10*1000);
// retry
Expand Down

0 comments on commit d1ccc5b

Please sign in to comment.