Fix CPU spikes for TLS connections using incompatible TLS protocol versions.

This commit is contained in:
Jan Vidar Krey 2019-06-18 16:01:44 +02:00
parent 0ae96b0da8
commit 78a7039240

View File

@ -90,11 +90,14 @@ static void probe_net_event(struct net_connection* con, int events, void *arg)
if (probe->hub->config->tls_enable) if (probe->hub->config->tls_enable)
{ {
LOG_TRACE("Probed TLS %d.%d connection", (int) probe_recvbuf[9], (int) probe_recvbuf[10]); LOG_TRACE("Probed TLS %d.%d connection", (int) probe_recvbuf[9], (int) probe_recvbuf[10]);
if (user_create(probe->hub, probe->connection, &probe->addr)) if (net_con_ssl_handshake(con, net_con_ssl_mode_server, probe->hub->ctx) < 0)
{
LOG_TRACE("TLS handshake negotiation failed.");
}
else if (user_create(probe->hub, probe->connection, &probe->addr))
{ {
probe->connection = 0; probe->connection = 0;
} }
net_con_ssl_handshake(con, net_con_ssl_mode_server, probe->hub->ctx);
} }
else else
{ {