feat: move server_sock to EPOLLET

This commit is contained in:
roman
2022-02-21 12:18:20 +03:00
parent 582310c70d
commit 386c39b58b

View File

@@ -117,7 +117,7 @@ int Server::delete_client(std::map<int, Client *> &client_map, int fd)
void Server::setup_server_socks(std::map<int, Socket> &configurations_map)
{
unsigned int server_events = EPOLLIN;
unsigned int server_events = EPOLLIN | EPOLLET;
for (std::vector<ServerConfig *>::iterator it = _configs.begin();
it != _configs.end(); ++it)
@@ -207,8 +207,9 @@ void Server::run(void)
/* DBOUT << "FD is " << fd << ENDL; */
/* print_epoll_events(events); */
if ((events & EPOLLIN)
&& (sock_it = configurations_map.find(fd)) != configurations_map.end())
if ((sock_it = configurations_map.find(fd)) != configurations_map.end())
{
while (1)
{
int client_sock = accept(fd,
(sock_it->second).getSockaddr(), (sock_it->second).getSocklen());
@@ -218,7 +219,9 @@ void Server::run(void)
add_to_epoll_list(client_sock, client_events);
}
else
throw std::logic_error("accept didnt work");
break;
/* throw std::logic_error("accept didnt work"); */
}
}
else
{