Start RAIIification for TLS.

This commit is contained in:
2026-01-10 03:22:35 -05:00
parent a93b762110
commit a30ae02d09
+8 -8
View File
@@ -64,28 +64,28 @@
#define CERT_STATUS_BAD 3
#define CERT_STATUS_USER_ACCEPTED 4
typedef struct {
struct Server_t {
char *hostname;
int port;
int cert_status;
} Server_t;
};
typedef struct {
struct FdMapEntry_t {
int fd;
int connkey;
} FdMapEntry_t;
};
/*
* Data type for TLS connection information
*/
typedef struct {
struct Conn_t {
int fd;
DilloUrl *url;
SSL *ssl;
bool connecting;
bool in_connect;
bool do_shutdown;
} Conn_t;
};
/* List of active TLS connections */
static Klist_t *conn_list = NULL;
@@ -166,7 +166,7 @@ static int Tls_conn_new(int fd, const DilloUrl *url, SSL *ssl)
{
int key;
Conn_t *conn = dNew0(Conn_t, 1);
Conn_t *conn = std::make_unique< Conn_t >().release();
conn->fd = fd;
conn->url = a_Url_dup(url).release();
conn->ssl = ssl;
@@ -415,7 +415,7 @@ int a_Tls_openssl_connect_ready(const DilloUrl *url)
if (s->cert_status == CERT_STATUS_NONE)
s->cert_status = CERT_STATUS_RECEIVING;
} else {
s = dNew(Server_t, 1);
s = std::make_unique< Server_t >().release();
s->hostname = dStrdup(URL_HOST(url));
s->port = URL_PORT(url);