Close file handle when download is completed.

This commit is contained in:
olegkap_cp
2011-01-12 21:44:32 +00:00
parent ea575472a0
commit c391b54b60
@@ -11,6 +11,7 @@ namespace Renci.SshClient.Sftp
private string _handle;
private ulong _offset = 0;
private uint _bufferSize = 1024;
private bool _closing = false;
public DownloadFileCommand(SftpSession sftpSession, uint bufferSize, string path, Stream output)
: base(sftpSession)
@@ -39,6 +40,11 @@ namespace Renci.SshClient.Sftp
base.OnStatus(statusCode, errorMessage, language);
if (statusCode == StatusCodes.Eof)
{
this.SendCloseMessage(this._handle);
this._closing = true;
}
else if (statusCode == StatusCodes.Ok && this._closing)
{
this.CompleteExecution();
}