public void AsyncConnect() { bool success = false; _asyncThread = Thread.CurrentThread; try { ITerminalConnection result = Connect(); if (!_interrupted) { success = true; Debug.Assert(result != null); ProtocolUtil.FireConnectionSucceeded(_param); _client.SuccessfullyExit(result); } } catch (Exception ex) { if (!(ex is LocalShellUtilException)) { RuntimeUtil.ReportException(ex); } if (!_interrupted) { _client.ConnectionFailed(ex.Message); ProtocolUtil.FireConnectionFailure(_param, ex.Message); } } finally { if (!success && _process != null && !_process.HasExited) { _process.Kill(); } } }
private void NotifyAsyncClient() { if (_succeeded) { _client.SuccessfullyExit(this.Result); } else { _client.ConnectionFailed(_errorMessage); } }
/// <summary> /// Start opening session /// </summary> /// <remarks> /// The implementation of this method also do validation of the input values. /// </remarks> /// <param name="client">an instance who receive the result of opening session.</param> /// <param name="terminalSettings">terminal settings is set if this method returns true.</param> /// <param name="interruptable">an object for cancellation is set if this method returns true.</param> /// <returns>true if the opening session has been started, or false if failed.</returns> public bool OpenSession(IInterruptableConnectorClient client, out ITerminalSettings terminalSettings, out IInterruptable interruptable) { ISSHLoginParameter loginParam; ITerminalSettings termSettings; string errorMessage; if (!Validate(out loginParam, out termSettings, out errorMessage)) { client.ConnectionFailed(errorMessage); terminalSettings = null; interruptable = null; return(false); } IProtocolService protocolservice = TerminalSessionsPlugin.Instance.ProtocolService; interruptable = protocolservice.AsyncSSHConnect(client, loginParam); terminalSettings = termSettings; return(true); }