Move g_ssl cleanup from reset_state() and only setup one ssl context per process.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1718 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Henrik Andersson 2013-06-20 10:50:39 +00:00
parent 8ba120fdbd
commit 8200b5bbd4

16
tcp.c
View File

@ -301,6 +301,9 @@ tcp_tls_connect(void)
g_ssl_initialized = True;
}
/* create process context */
if (g_ssl_ctx == NULL)
{
g_ssl_ctx = SSL_CTX_new(TLSv1_client_method());
if (g_ssl_ctx == NULL)
{
@ -311,9 +314,14 @@ tcp_tls_connect(void)
options = 0;
options |= SSL_OP_NO_COMPRESSION;
options |= SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
SSL_CTX_set_options(g_ssl_ctx, options);
}
/* free old connection */
if (g_ssl)
SSL_free(g_ssl);
/* create new ssl connection */
g_ssl = SSL_new(g_ssl_ctx);
if (g_ssl == NULL)
{
@ -560,12 +568,6 @@ tcp_reset_state(void)
{
int i;
if (g_ssl)
{
SSL_free(g_ssl);
g_ssl = NULL;
}
/* Clear the incoming stream */
if (g_in.data != NULL)
xfree(g_in.data);