mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Fix: do keep SSL state when reusing a TLS connection.
This commit is contained in:
parent
a18e2540fb
commit
7bc7472972
16
src/client.c
16
src/client.c
@ -103,6 +103,22 @@ static inline void client_reuseconnection(client_t *client) {
|
|||||||
con = connection_create(con->sock, con->serversock, strdup(con->ip));
|
con = connection_create(con->sock, con->serversock, strdup(con->ip));
|
||||||
reuse = client->reuse;
|
reuse = client->reuse;
|
||||||
client->con->sock = -1; /* TODO: do not use magic */
|
client->con->sock = -1; /* TODO: do not use magic */
|
||||||
|
|
||||||
|
/* handle to keep the TLS connection */
|
||||||
|
#ifdef HAVE_OPENSSL
|
||||||
|
if (client->con->ssl) {
|
||||||
|
/* AHhhggrr.. That pain....
|
||||||
|
* stealing SSL state...
|
||||||
|
*/
|
||||||
|
con->ssl = client->con->ssl;
|
||||||
|
con->read = client->con->read;
|
||||||
|
con->send = client->con->send;
|
||||||
|
client->con->ssl = NULL;
|
||||||
|
client->con->read = NULL;
|
||||||
|
client->con->send = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
client->reuse = ICECAST_REUSE_CLOSE;
|
client->reuse = ICECAST_REUSE_CLOSE;
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
@ -410,6 +410,9 @@ connection_t *connection_create (sock_t sock, sock_t serversock, char *ip)
|
|||||||
void connection_uses_ssl(connection_t *con)
|
void connection_uses_ssl(connection_t *con)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
|
if (con->ssl)
|
||||||
|
return;
|
||||||
|
|
||||||
con->read = connection_read_ssl;
|
con->read = connection_read_ssl;
|
||||||
con->send = connection_send_ssl;
|
con->send = connection_send_ssl;
|
||||||
con->ssl = SSL_new(ssl_ctx);
|
con->ssl = SSL_new(ssl_ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user