Renci.SshNet.Sftp.SftpSession.RequestFStatVfs C# (CSharp) Method

RequestFStatVfs() private method

Performs [email protected] extended request.
private RequestFStatVfs ( byte handle, bool nullOnError = false ) : SftpFileSytemInformation
handle byte The file handle.
nullOnError bool if set to true [null on error].
return SftpFileSytemInformation
        internal SftpFileSytemInformation RequestFStatVfs(byte[] handle, bool nullOnError = false)
        {
            if (ProtocolVersion < 3)
            {
                throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "SSH_FXP_EXTENDED operation is not supported in {0} version that server operates in.", ProtocolVersion));
            }

            SshException exception = null;

            SftpFileSytemInformation information = null;

            using (var wait = new AutoResetEvent(false))
            {
                var request = new FStatVfsRequest(ProtocolVersion, NextRequestId, handle,
                    response =>
                        {
                            information = response.GetReply<StatVfsReplyInfo>().Information;
                            wait.Set();
                        },
                    response =>
                        {
                            exception = GetSftpException(response);
                            wait.Set();
                        });

                if (!_supportedExtensions.ContainsKey(request.Name))
                    throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Extension method {0} currently not supported by the server.", request.Name));

                SendRequest(request);

                WaitOnHandle(wait, OperationTimeout);
            }
            
            if (!nullOnError && exception != null)
            {
                throw exception;
            }

            return information;
        }