WIP CGI monitered by epoll
+ OK, but some errors case need to be lookup
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
void Webserv::_close_client(int fd)
|
||||
{
|
||||
std::vector<Client>::iterator it = _clients.begin();
|
||||
while (it != _clients.end())
|
||||
std::vector<Client>::iterator it_end = _clients.end();
|
||||
while (it != it_end)
|
||||
{
|
||||
if (*it == fd)
|
||||
{
|
||||
@@ -32,15 +33,48 @@ void Webserv::_close_all_clients_fd()
|
||||
while (it != it_end)
|
||||
{
|
||||
// _epoll_update(_clients.back().fd, 0, EPOLL_CTL_DEL); // normalement superflu, DEBUG
|
||||
std::cerr << "close fd " << _clients.back().get_cl_fd() << "\n";
|
||||
if (::close(_clients.back().get_cl_fd()) == -1)
|
||||
std::cerr << "close fd " << it->get_cl_fd() << "\n";
|
||||
if (::close(it->get_cl_fd()) == -1)
|
||||
std::perror("err close()");
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
void Webserv::_close_all_listen_sockets()
|
||||
// TODO : not sure for zombie cgi-proccess, need to verif
|
||||
void Webserv::_close_cgi_pipe_rfd(int fd)
|
||||
{
|
||||
std::vector<cgi_pipe_rfd>::iterator it = _cgi_pipe_rfds.begin();
|
||||
std::vector<cgi_pipe_rfd>::iterator it_end = _cgi_pipe_rfds.end();
|
||||
while (it != it_end)
|
||||
{
|
||||
if (*it == fd)
|
||||
{
|
||||
std::cerr << "close cgi-fd " << fd << "\n";
|
||||
if (::close(fd) == -1)
|
||||
std::perror("err close()");
|
||||
_cgi_pipe_rfds.erase(it);
|
||||
break;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
void Webserv::_close_all_cgi_pipe_rfd()
|
||||
{
|
||||
std::vector<cgi_pipe_rfd>::iterator it = _cgi_pipe_rfds.begin();
|
||||
std::vector<cgi_pipe_rfd>::iterator it_end = _cgi_pipe_rfds.end();
|
||||
while (it != it_end)
|
||||
{
|
||||
std::cerr << "close cgi-fd " << it->fd << "\n";
|
||||
if (::close(it->fd) == -1)
|
||||
std::perror("err close()");
|
||||
++it;
|
||||
}
|
||||
_cgi_pipe_rfds.clear();
|
||||
}
|
||||
|
||||
void Webserv::_close_all_listen_sockets()
|
||||
{ // TODO : change like clients (clear in place of pop_back)
|
||||
while (!_listen_sockets.empty())
|
||||
{
|
||||
// _epoll_update(_listen_sockets.back().fd, 0, EPOLL_CTL_DEL); // normalement superflu, DEBUG
|
||||
|
||||
Reference in New Issue
Block a user