Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Commented Issue: Forwarded Port channels can get stuck waiting [1558]

$
0
0
I was testing ssh.net with 2 ForwardedPortLocals. When a connection is established, a port is forwarded properly but the channel is sometimes not closed, depending on how the local port was closed.

It can get stuck waiting for an EOF that never comes in ChannelDirectTcpip.cs Bind()
System.Threading.WaitHandle.WaitAny(new WaitHandle[] { this._channelEof });

this is because the while loop above can exit gracefully if _socket.CanRead() returns false. In this scenario no CloseMessage was ever sent so it will sit waiting forever. I suggest adding:

this.SendMessage( new ChannelCloseMessage( this.RemoteChannelNumber ) );

after the while loop or moving the WaitAny line into Close();
Comments: ** Comment from web user: nlewis **

A fix for the second problem is to dispose the _socket in ChannelDirectTcpip.cs in OnErrorOccurred and OnDisconnected. Disposing the socket will ensure that the call to _socket.CanRead() which lets the thread exit and also informs the locally connected client that the socket is dead.


Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>