ClientInfo is more RAII-ish now.

This commit is contained in:
2026-01-10 00:26:03 -05:00
parent 1bc9cf7d92
commit 7e9b10e89d
+10 -14
View File
@@ -92,6 +92,7 @@ struct DilloDir {
};
struct ClientInfo {
~ClientInfo();
Dsh *sh;
std::optional< std::string > orig_url;
std::optional< std::string > filename;
@@ -280,14 +281,6 @@ static std::unique_ptr< DilloDir > File_dillodir_new(const std::string &dirname)
return Ddir;
}
/*
* Deallocate a DilloDir structure.
*/
static void File_dillodir_free(DilloDir *Ddir)
{
delete Ddir;
}
/*
* Output the string for parent directory
*/
@@ -914,15 +907,18 @@ static void File_remove_client(ClientInfo *client)
{
dList_remove(Clients, (void *)client);
_MSG("Closing Socket Handler\n");
a_Dpip_dsh_close(client->sh);
a_Dpip_dsh_free(client->sh);
File_close(client->file_fd);
File_dillodir_free(client->d_dir);
delete client;
}
ClientInfo::~ClientInfo()
{
_MSG("Closing Socket Handler\n");
a_Dpip_dsh_close(sh);
a_Dpip_dsh_free(sh);
File_close(file_fd);
delete d_dir;
}
/*
* Serve this client.
*/