When SftpClient is disconnected during SftpClient .DownloadFile
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 4.4k
- Fork
- 993
- Merge medio
- 9g 21h
- PR unite (30g)
- 1
Descrizione
Hi! together!
I've tried to download some files by SftpClient. Sometimes the program got freeze for some reason.
It's what I've tried to debug to see what was happening.
client.DownloadFile(sFilePath, fileStream, offset =>
{
try
{
if (offset > 4389170) // I assume that the connection is disconnected while the file is being downloaded.
client.Disconnect();
}
catch (Exception ex)
{
}
});
I've tried to make SftpClient disconnected while the file is being downloaded.
It seems I success reproduce the problem that I'm dealing with. (Actually I'm not 100% sure..)
It's doing nothing when It's disconnected. It is maybe because nothing come in on the callback function.
When if it turns out it's a bug, how about add some code inside of SftpClient.InternalDownloadFile while clause
if (IsConnected == false)
throw new SshConnectionException("Connection has been disconnected.");
PS. It's my first time to post Issues on github. If there are some mistakes, please let me know.
UPDATE
I've checked it's stuck in a deadlock in SftpFileReader.Read() function when the connection get disconnected while file is being downloaded. Please someone help me and I want to discuss how to solve this problem with all of you.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo la disconnessione durante SftpClient.DownloadFile, quindi esamina SftpClient.InternalDownloadFile e il deadlock identificato nell’issue in SftpFileReader.Read(). Traccia cosa accade quando la connessione viene chiusa mentre il callback di download è attivo. Il lavoro è completato quando il download non rimane più bloccato e lo stato di disconnessione viene gestito con un comportamento di errore osservabile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- networking
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100