sshnet / sshnet/SSH.NET

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

Ouverte
#591 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

enhancement
Langage dominant
C#
Étoiles
4.4k
Forks
993
Merge moyen
9 j 21 h
PR mergées (30 j)
1

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par suivre ShellStream.BeginExpect et EndExpect afin de comprendre comment l’opération expect et AsyncResult sont terminés. Définissez le comportement d’annulation afin qu’un expect puisse s’arrêter rapidement sans terminer le résultat deux fois, puis ajoutez une couverture pour l’annulation et pour les chemins existants de timeout ou de match. Le travail est terminé lorsque l’annulation retourne rapidement et que le travail expect en arrière-plan se termine proprement.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp
Domaine
networking
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.