示例#1
0
 public virtual void CleanupErrorStatus()
 {
     if (_connection != null && _connection.IsOpen)
     {
         _connection.Close();
     }
 }
示例#2
0
 private void CloseShell()
 {
     m_conn.Close();
     m_conn    = null;
     m_treader = null;
     m_stream  = null;
 }
示例#3
0
        //profに対応したSSHConnectionを返す。接続がなければparentを親に認証ダイアログを出して認証する
        public SSHConnection GetOrCreateConnection(ChannelProfile prof, Form parent)
        {
            //ホスト名とアカウントのペアからコネクションを共有する仕組みがあるとよいかも
            SSHConnection c = (SSHConnection)_profileToConnection[prof];

            if (c != null)
            {
                return(c);
            }

            SSHShortcutLoginDialog dlg = new SSHShortcutLoginDialog(prof);

            if (dlg.ShowDialog(parent) == DialogResult.OK)
            {
                c = dlg.Result.Connection;
                try {
                    dlg.Result.WaitRequest();
                }
                catch (Exception ex) {
                    Debug.WriteLine(ex.StackTrace);
                    Util.Warning(parent, ex.Message);
                    c.Close();
                    return(null);
                }
                _profileToConnection[prof] = c;
                Env.MainForm.RefreshProfileStatus(prof);
            }

            return(c);
        }
示例#4
0
        public void OnChannelEOF()
        {
            m_Channel.Close();

            OnTrace(ErlTraceLevel.Ctrl, Direction.Inbound, "Channel EOF");
            //close connection
            m_Connection.Close();
        }
示例#5
0
        public void SetHTTPRequestTimeout()
        {
            StartRequest = DateTime.Now;

            int seconds = TimeoutSeconds;

            while (seconds > 0)
            {
                seconds--; Thread.Sleep(1000);
                if (EndRequest != null)
                {
                    break;
                }
            }

            if (seconds <= 0 && EndRequest == null)
            {
                //Close anything
                try
                {
                    _conn.CancelForwardedPort("localhost", 80);
                }
                catch { }
                try
                {
                    _pf.Close();
                }
                catch { }
                try
                {
                    _conn.Disconnect("");
                }
                catch { }
                try
                {
                    _conn.Close();
                }
                catch { }

                passControl(LineIndex, false, "", "HTTP Request Timeout");
            }
        }