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

Created Unassigned: Check Channel.IsOpen before using it [1655]

$
0
0
The channel for a forwarding should be checked for being opened (IsOpen) before binding/closing it.
Else a Exception occurs and kills the whole connection.

Renci.SshNet\ForwardedPortRemote.NET.cs
```
this.ExecuteThread(() =>
{
try
{
IPEndPoint originatorEndPoint = socket.RemoteEndPoint as IPEndPoint;

this.RaiseRequestReceived(originatorEndPoint.Address.ToString(), (uint)originatorEndPoint.Port);

var channel = this.Session.CreateChannel<ChannelDirectTcpip>();

channel.Open(this.Host, this.Port, socket);
if (!channel.IsOpen)
{
socket.Close();
throw new SshException("Unable to open Channel for Forwarding.");
return;
}
channel.Bind();
channel.Close();
}
catch (Exception exp)
{
this.RaiseExceptionEvent(exp);
}
});
```

Viewing all articles
Browse latest Browse all 1026

Trending Articles



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