diff options
author | Eugene Tarassov | 2015-02-13 21:28:24 +0000 |
---|---|---|
committer | Eugene Tarassov | 2015-02-13 21:29:14 +0000 |
commit | cd4dcd7cf84fccb7be54529356c702850bba579a (patch) | |
tree | bd40f9ade061c42257905c274dd4eb79244212c5 | |
parent | 73869f0b3a61a59690d5c555827e950b6e9ec368 (diff) | |
download | org.eclipse.tcf-cd4dcd7cf84fccb7be54529356c702850bba579a.tar.gz org.eclipse.tcf-cd4dcd7cf84fccb7be54529356c702850bba579a.tar.xz org.eclipse.tcf-cd4dcd7cf84fccb7be54529356c702850bba579a.zip |
TCF Debugger: fixed: disconnect command fails with error if issued while channel is still connecting
-rw-r--r-- | plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java index 9a40c9c8a..0ab1caa42 100644 --- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java +++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java @@ -1257,31 +1257,33 @@ public class TCFLaunch extends Launch { } })); } - IStreams streams = getService(IStreams.class); - IStreams.DoneDisconnect done_disconnect = new IStreams.DoneDisconnect() { - public void doneDisconnect(IToken token, Exception error) { - cmds.remove(token); - if (error != null) channel.terminate(error); - else if (cmds.isEmpty()) channel.close(); + if (channel.getState() == IChannel.STATE_OPEN) { + IStreams streams = getService(IStreams.class); + IStreams.DoneDisconnect done_disconnect = new IStreams.DoneDisconnect() { + public void doneDisconnect(IToken token, Exception error) { + cmds.remove(token); + if (error != null) channel.terminate(error); + else if (cmds.isEmpty()) channel.close(); + } + }; + for (String id : process_stream_ids.keySet()) { + cmds.add(streams.disconnect(id, done_disconnect)); + } + for (String id : uart_rx_stream_ids.keySet()) { + cmds.add(streams.disconnect(id, done_disconnect)); + } + for (String id : uart_tx_stream_ids.keySet()) { + cmds.add(streams.disconnect(id, done_disconnect)); + } + process_stream_ids.clear(); + process_input_stream_id = null; + uart_rx_stream_ids.clear(); + uart_tx_stream_ids.clear(); + if (dprintf_stream_id != null) { + disconnected_stream_ids.add(dprintf_stream_id); + cmds.add(streams.disconnect(dprintf_stream_id, done_disconnect)); + dprintf_stream_id = null; } - }; - for (String id : process_stream_ids.keySet()) { - cmds.add(streams.disconnect(id, done_disconnect)); - } - for (String id : uart_rx_stream_ids.keySet()) { - cmds.add(streams.disconnect(id, done_disconnect)); - } - for (String id : uart_tx_stream_ids.keySet()) { - cmds.add(streams.disconnect(id, done_disconnect)); - } - process_stream_ids.clear(); - process_input_stream_id = null; - uart_rx_stream_ids.clear(); - uart_tx_stream_ids.clear(); - if (dprintf_stream_id != null) { - disconnected_stream_ids.add(dprintf_stream_id); - cmds.add(streams.disconnect(dprintf_stream_id, done_disconnect)); - dprintf_stream_id = null; } if (cmds.isEmpty()) channel.close(); } |