Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: ChannelDirectTcpip incorrectly waits for EOF

$
0
0
In ChannelDirectTcpIp.cs, there are the following lines after the receive loop:
//  Channel was open and we MUST receive EOF notification, 
//  data transfer can take longer then connection specified timeout
//  If listener thread is finished then socket was closed       
System.Threading.WaitHandle.WaitAny(new WaitHandle[] { this._channelEof });
However, I don't understand the justification. A "channel closed message" will only be received if the remote end closes the connection. If the local end is expected to close it, WaitAny will block indefinitely (at least until a timeout occurs), which is the case I'm encountering right now. Commenting this line makes everything work fine: however I suppose it's here for a reason.

I also changed a few things related to ChannelDirectTcpip:
  • Added a using directive for the channel variable, line 56 of ForwardedPortLocal, so that the channel is always closed even if there is an exception. I suppose it's simply an omission.
  • CanRead and CanWrite extensions, as they are used in the .NET framework build, seem weird. Polling with SelectRead means that data should be available immediately, which isn't always the case. If data isn't immediately available on the socket, the read loop in ChannelDirectTcpip will stop rather than waiting! I changed CanRead to only check for socket.Connected, as the Silverlight method do. In fact, I think those methods should be removed and just replaced by socket.IsConnected. What do you think?
I didn't submit a patch so that we can discuss these issues first and find the appropriate solution.

Viewing all articles
Browse latest Browse all 1729

Trending Articles



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