🔨」 fix: fixed but why i don't know

This commit is contained in:
2025-04-23 15:34:42 +02:00
parent e28807078f
commit 5a2285e3d0
2 changed files with 3 additions and 9 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/11 16:11:40 by adjoly #+# #+# */
/* Updated: 2025/04/23 12:38:15 by adjoly ### ########.fr */
/* Updated: 2025/04/23 15:31:41 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -125,17 +125,12 @@ void Server::_run(void) {
_client_fds.push_back(pfd);
struct sockaddr_in* new_client_sock = new sockaddr_in();
std::memmove(new_client_sock, &client_addr, sizeof(struct sockaddr_in));
std::cout << "tamere ==== " << new_client_sock << std::endl;
_client_data.push_back(new_client_sock);
}
for (size_t i = _fds_server.size(); i < _client_fds.size(); ++i) {
std::cout << i << std::endl;
if (_client_fds[i].revents & POLLIN) {
std::cout << _client_fds.size() << " " << _client_data.size() << std::endl;
std::cout << "tamere ==== " << _client_data[i] << std::endl;
std::cout << i << std::endl;
if (!_handle_client(_client_fds[i], _client_data[i])) {
if (_handle_client(_client_fds[i], _client_data[i])) {
close(_client_fds[i].fd);
_client_fds.erase(_client_fds.begin() + i);
delete _client_data[i];

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/17 11:58:42 by adjoly #+# #+# */
/* Updated: 2025/04/23 12:33:47 by adjoly ### ########.fr */
/* Updated: 2025/04/23 15:33:00 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -87,7 +87,6 @@ int Server::_createSocket(std::string host, int port) {
bool Server::_handle_client(struct pollfd &pollfd, sockaddr_in *sock_data) {
try {
std::cout << "tamere ==== " << sock_data << std::endl;
Client client(pollfd.fd, *sock_data, _conf);
client.answer();
} catch (std::runtime_error &e) {