示例#1
0
            public override void Close()
            {
                base.Close();

                if (_channel != null)
                {
                    try
                    {
                        _exitStatus = _channel.GetExitStatus();

                        if (_channel.IsConnected)
                        {
                            _channel.Disconnect();
                        }
                    }
                    finally
                    {
                        _channel = null;
                    }
                }
            }
示例#2
0
            public SshPushConnection(TransportGitSsh instance)
                : base(instance)
            {
                try
                {
                    _channel = instance.Exec(instance.OptionReceivePack);

                    if (_channel.IsConnected)
                    {
                        init(_channel.GetInputStream(), _channel.GetOutputStream());
                    }
                    else
                    {
                        throw new TransportException(uri, instance._errStream.ToString());
                    }
                }
                catch (TransportException)
                {
                    Close();
                    throw;
                }
                catch (SocketException err)
                {
                    Close();
                    throw new TransportException(uri, "remote hung up unexpectedly", err);
                }

                try
                {
                    readAdvertisedRefs();
                }
                catch (NoRemoteRepositoryException notFound)
                {
                    Close();
                    instance.checkExecFailure(_exitStatus, instance.OptionReceivePack);
                    throw instance.cleanNotFound(notFound);
                }
            }