Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Created Issue: Synchronization bug in SftpClient.InternalUploadFile [1502]

$
0
0
Hi,
my name is Jacek Drozdowski I'm Senior Software Developer at Jack Wills London.
We started use SshNET library to upload files on SFTP (private key) server.

I found a bug with synchronization of reading stream (line 1501) and writing ftp request. (line 1475) in SftpClient.InternalUploadFile method.
On end of loop (line 1511) you are checking
} while (expectedResponses > 0);
which is not enough because if notification from RequestWrite (1475) is faster than input.Read (1501) value of expectedResponses is equal 0 and transfer is finished without exception!!!

I had a problem with this testing my solution on local computer with local FTP server.
You can simply reproduce this bug using test in debug mode and real FTP server. Make breakpoint at line 1501 and wait for response from FTP. Result is obvious: transfer is finished without informing user about partial transfer.

Solution is very simple, please change line 1511 to:
} while (expectedResponses > 0 || bytesRead > 0);
because we are waiting for expected request from FTP and we are checking buffer to send as well.

Kind Regards

Jacek Drozdowski

Senior Software Developer
Jack Wills
London NW10 6DJ, UK

Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>