Skip to content

Commit

Permalink
fix timeoutexception during upload/download
Browse files Browse the repository at this point in the history
  • Loading branch information
robinrodricks committed Oct 31, 2019
1 parent c4989d6 commit 2bef783
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions FluentFTP/Client/FtpClient_HighLevelDownload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -697,10 +697,10 @@ private bool DownloadFileInternal(string remotePath, Stream outStream, long rest
throw;
}
}
catch (FtpException ex) {
catch (TimeoutException ex) {
// fix: attempting to download data after we reached the end of the stream
// often throws a timeout execption, so we silently absorb that here
if (offset >= fileLen && ex.InnerException != null && ex.InnerException is TimeoutException) {
if (offset >= fileLen) {
break;
}
else {
Expand Down Expand Up @@ -843,10 +843,10 @@ private bool DownloadFileInternal(string remotePath, Stream outStream, long rest
throw;
}
}
catch (FtpException ex) {
catch (TimeoutException ex) {
// fix: attempting to download data after we reached the end of the stream
// often throws a timeout execption, so we silently absorb that here
if (offset >= fileLen && ex.InnerException != null && ex.InnerException is TimeoutException) {
if (offset >= fileLen) {
break;
}
else {
Expand Down
8 changes: 4 additions & 4 deletions FluentFTP/Client/FtpClient_HighLevelUpload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -757,10 +757,10 @@ private bool UploadFileInternal(Stream fileData, string remotePath, bool createR
throw;
}
}
catch (FtpException ex) {
catch (TimeoutException ex) {
// fix: attempting to upload data after we reached the end of the stream
// often throws a timeout execption, so we silently absorb that here
if (offset >= fileLen && ex.InnerException != null && ex.InnerException is TimeoutException) {
if (offset >= fileLen) {
break;
}
else {
Expand Down Expand Up @@ -978,10 +978,10 @@ private bool UploadFileInternal(Stream fileData, string remotePath, bool createR
throw;
}
}
catch (FtpException ex) {
catch (TimeoutException ex) {
// fix: attempting to upload data after we reached the end of the stream
// often throws a timeout execption, so we silently absorb that here
if (offset >= fileLen && ex.InnerException != null && ex.InnerException is TimeoutException) {
if (offset >= fileLen) {
break;
}
else {
Expand Down

0 comments on commit 2bef783

Please sign in to comment.