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);
}
});
```
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);
}
});
```