sshnet / sshnet/SSH.NET

ShellStream.EndExpect continues to wait for a match until the timeout is reached

Aperta
#591 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement
Lingua principale
C#
Stelle
4.4k
Fork
993
Merge medio
9g 21h
PR unite (30g)
1

Descrizione

I am using the published stable Renci SSH.NET nuget package (2016.1.0)

I am successfully using ShellStreams BeginExpect method to wait asynchronously for one of several patterns to match until a timeout is reached. Additionally, I would like to be able to cancel the expect at any time arbitrarily.

I had hoped EndExpect would immediately stop the expect thread, but instead the behaviour appears to be that EndExpect blocks until a match is found.

I have tried setting the AsyncResult as completed using SetAsCompleted before calling EndExpect to bypass this behaviour, but the thread will continue to search for matches in the background until it eventually calls SetAsCompleted itself and throws an exception (InvalidOperationException - You can set a result only once).

I would like to propose a CancelExpect method that quickly sets the AsyncResult as cancelled and causes the expect thread to quickly exit.

I'm very happy to implement this feature myself, I would just like to know if there is already a better approach for what I am trying to do, and which branch I should be basing my work on.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia tracciando ShellStream.BeginExpect e EndExpect per capire come vengono completati l’operazione expect e AsyncResult. Definisci il comportamento di annullamento in modo che un expect possa arrestarsi rapidamente senza completare il risultato due volte, quindi aggiungi la copertura per l’annullamento e per i percorsi esistenti di timeout o match. Il lavoro è completo quando l’annullamento restituisce rapidamente e il lavoro expect in background termina correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
networking
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.