sshnet / sshnet/SSH.NET

RemoveForwardedPort when disconnected

Aperta
#879 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Hi folks.
My scenario is long running SSH tunneling connection with a number of ForwardedPortRemote's.
I do
sshClient.ErrorOccurred += delegate (object sender, ExceptionEventArgs e){ . . . }
and
portRemote.Exception += delegate (Object source, ExceptionEventArgs args){ . . . }
and then handle these events.
Since it is long running connection, when it gets disrupted (cable plugged off, internet down etc), the software then tries to reconnect ssh client. As soon as the Internet access is again available, it reconnects.
When the connection gets interrupted and the above events fire, I want to stop/dispose/remove forwarded ports from the ssh client, so when the new connection is established, there are no leftover unused/stopped ports.
The problem is when I call SshClient.RemoveForwardedPort(port), it throws "Client not connected" exception. And it throws it both when its disconnected and after reconnection too. Thus I cannot remove "old" forwarded unused ports.
How or at what point can I remove those ports? Or eventually can I reuse them?

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 con SshClient.RemoveForwardedPort, ForwardedPortRemote e il flusso degli eventi ErrorOccurred e Exception descritto nell’issue. Traccia il comportamento delle porte inoltrate durante la disconnessione e la riconnessione, quindi verifica che le porte arrestate possano essere rimosse o riutilizzate senza generare un’eccezione "Client not connected".

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
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.