ShellStream.EndExpect continues to wait for a match until the timeout is reached
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C#
- Sterne
- 4.4k
- Forks
- 993
- Ø Merge
- 9 T. 21 Std.
- Gemergte PRs (30 T.)
- 1
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, ShellStream.BeginExpect und EndExpect nachzuverfolgen, um zu verstehen, wie der expect-Vorgang und AsyncResult abgeschlossen werden. Lege das Abbruchverhalten so fest, dass ein expect-Vorgang umgehend beendet werden kann, ohne das Ergebnis zweimal abzuschließen, und füge Abdeckung für den Abbruch sowie die vorhandenen Timeout- oder Match-Pfade hinzu. Erledigt ist die Aufgabe, wenn der Abbruch umgehend zurückkehrt und die expect-Arbeit im Hintergrund sauber beendet wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp
- Bereich
- networking
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100