Hi Frederic,
It turns out to be the server side of the problem you reported earlier, which we already fixed, and the fix is in the build we sent you.)
the workaround is the same as the client-side one in the other thread
using System.Net.Sockets;
using RemObjects.SDK;
public class TimeoutAwareSslServerFactory : IConnectionFactory
{
private readonly SslConnectionFactory fSslOptions;
private readonly int fHandshakeTimeout;
public TimeoutAwareSslServerFactory(SslConnectionFactory sslOptions, int handshakeTimeout)
{
this.fSslOptions = sslOptions;
this.fHandshakeTimeout = handshakeTimeout;
}
public Connection CreateServerConnection(Socket socket)
{
this.fSslOptions.LoadCertificate();
var inner = new InnerConnection(socket);
inner.TimeoutEnabled = true;
inner.Timeout = this.fHandshakeTimeout;
return new SslConnection(this.fSslOptions, inner);
}
public Connection CreateClientConnection(Binding binding)
{
return this.fSslOptions.CreateClientConnection(binding);
}
// SslConnection reads whatever has already arrived. A plain Connection would
// block for a full buffer here and stall healthy handshakes.
private class InnerConnection : Connection
{
public InnerConnection(Socket socket) : base(socket) { }
public override int Read(byte[] buffer, int offset, int size)
{
return this.ReceiveWhatsAvailable(buffer, offset, size);
}
}
}
Set it on the channel after SslOptions is configured, before the server is opened:
var channel = (IpTcpServerChannel)server.NetworkServer.ServerChannel;
channel.TcpServer.ConnectionFactory =
new TimeoutAwareSslServerFactory(channel.SslOptions, channel.TcpServer.Timeout);
This only applies with TLS enabled on that channel. If SslOptions.Enabled is off there, let us know then the threads are following connections that stay open, and we should look at that instead.