+ Client get return reference + wip binary flags for http_method + moved config parser files
35 lines
728 B
C++
35 lines
728 B
C++
|
|
#include "Webserv.hpp"
|
|
|
|
void Webserv::_close_client(int fd)
|
|
{
|
|
std::vector<Client>::iterator it = _clients.begin();
|
|
while (it != _clients.end())
|
|
{
|
|
if (*it == fd)
|
|
{
|
|
// _epoll_update(fd, 0, EPOLL_CTL_DEL); // normalement superflu, DEBUG
|
|
if (::close(fd) == -1)
|
|
std::perror("err close()");
|
|
else
|
|
std::cerr << "close fd " << fd << "\n";
|
|
_clients.erase(it);
|
|
break;
|
|
}
|
|
++it;
|
|
}
|
|
}
|
|
|
|
void Webserv::_close_all_clients()
|
|
{
|
|
while (!_clients.empty())
|
|
{
|
|
// _epoll_update(_clients.back().fd, 0, EPOLL_CTL_DEL); // normalement superflu, DEBUG
|
|
if (::close(_clients.back().fd) == -1)
|
|
std::perror("err close()");
|
|
else
|
|
std::cerr << "close fd " << _clients.back().fd << "\n";
|
|
_clients.pop_back();
|
|
}
|
|
}
|