lots of log message and fixed bad_file_descriptor issue

This commit is contained in:
hugogogo
2022-08-22 01:50:28 +02:00
parent 469eca8aa9
commit 5225e3258b
18 changed files with 186 additions and 112 deletions

View File

@@ -34,9 +34,12 @@ void Webserv::_handle_epollerr_cgi_output(uint32_t events, Client *client)
if (wait_ret == client->cgi_pid)
{
_epoll_update(client->cgi_pipe_r_from_child, 0, EPOLL_CTL_DEL);
std::cerr << family << "| (" << std::setw(2) << client->get_cl_fd() << ") close pipe rfc [" << client->cgi_pipe_r_from_child << "]\n";
if (::close(client->cgi_pipe_r_from_child) == -1)
std::perror("err close()");
client->cgi_pipe_r_from_child = -1;
_epoll_update(client->get_cl_fd(), EPOLLOUT, EPOLL_CTL_ADD);
}
@@ -52,9 +55,12 @@ void Webserv::_handle_epollhup_cgi_output(uint32_t events, Client *client)
if (wait_ret == client->cgi_pid)
{
_epoll_update(client->cgi_pipe_r_from_child, 0, EPOLL_CTL_DEL);
std::cerr << family << "| (" << std::setw(2) << client->get_cl_fd() << ") close pipe rfc [" << client->cgi_pipe_r_from_child << "]\n";
if (::close(client->cgi_pipe_r_from_child) == -1)
std::perror("err close()");
client->cgi_pipe_r_from_child = -1;
_epoll_update(client->get_cl_fd(), EPOLLOUT, EPOLL_CTL_ADD);
client->cgi_state = CGI_OUTPUT_COMPLETE;
}