added semaphore and shared memory to print without superposition between parent and child process

This commit is contained in:
hugogogo
2022-08-22 14:52:31 +02:00
parent 5225e3258b
commit f7b31c7db7
14 changed files with 127 additions and 65 deletions

View File

@@ -7,7 +7,7 @@
*/
void Webserv::_get(Client *client, std::string &path)
{
std::cerr << family << "| (" << std::setw(2) << client->get_cl_fd() << ") _get()\n"; // debug
print_secure(client->get_cl_fd(), "_get()\n");
if (eval_file_type(path) == IS_DIR)
{
if (path[path.size() - 1] != '/')
@@ -18,7 +18,7 @@ void Webserv::_get(Client *client, std::string &path)
{
path.append(client->assigned_location->index[i]);
_get_file(client, path);
std::cerr << family << "| (" << std::setw(2) << client->get_cl_fd() << ") Added an index\n"; //debug
print_secure(client->get_cl_fd(), "Added an index\n");
return ;
}
}
@@ -41,7 +41,7 @@ void Webserv::_get_file(Client *client, const std::string &path)
std::ifstream ifd; // For chunk, ifstream directly in struct CLient for multiples read without close() ?
std::stringstream buf;
std::cerr << family << "| (" << std::setw(2) << client->get_cl_fd() << ") _get_file()\n";
print_secure(client->get_cl_fd(), "_get_file()\n");
client->status = ::eval_file_access(path, R_OK);
if (client->status)
return;