From 2f549042471531953257035e5bb33bd646d3fd61 Mon Sep 17 00:00:00 2001 From: uwe Date: Fri, 18 Oct 2013 15:42:05 +0200 Subject: [PATCH] Terminal: Fix - Telnet connector prints confusing "Connection refused" Telnet connector prints "Connection refused" to terminal control while the terminal is already disconnected again. This is very confusing for the user and should be avoided. --- .../tm/internal/terminal/telnet/TelnetConnectWorker.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/terminal/plugins/org.eclipse.tm.terminal.telnet/src/org/eclipse/tm/internal/terminal/telnet/TelnetConnectWorker.java b/terminal/plugins/org.eclipse.tm.terminal.telnet/src/org/eclipse/tm/internal/terminal/telnet/TelnetConnectWorker.java index 4c1dcc42eac..308f1f8b0c4 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.telnet/src/org/eclipse/tm/internal/terminal/telnet/TelnetConnectWorker.java +++ b/terminal/plugins/org.eclipse.tm.terminal.telnet/src/org/eclipse/tm/internal/terminal/telnet/TelnetConnectWorker.java @@ -93,8 +93,11 @@ class TelnetConnectWorker extends Thread { connectFailed(socketTimeoutException.getMessage(), "Connection Error!\n" + socketTimeoutException.getMessage()); //$NON-NLS-1$ } catch (ConnectException connectException) { // In case of a ConnectException, do a re-try. The server could have been - // simply not ready yet and the worker would give up to early. - if (remaining == 0) connectFailed(connectException.getMessage(),"Connection refused!"); //$NON-NLS-1$ + // simply not ready yet and the worker would give up to early. If the terminal + // control is already closed (disconnected), don't print "Connection refused" errors + if (remaining == 0 && TerminalState.CLOSED != fControl.getState()) { + connectFailed(connectException.getMessage(),"Connection refused!"); //$NON-NLS-1$ + } } catch (Exception exception) { // Any other exception on connect. No re-try in this case either remaining = 0;