mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-11 07:18:45 +02:00
「🔨」 fix: fixed but why i don't know
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/11 16:11:40 by adjoly #+# #+# */
|
/* 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);
|
_client_fds.push_back(pfd);
|
||||||
struct sockaddr_in* new_client_sock = new sockaddr_in();
|
struct sockaddr_in* new_client_sock = new sockaddr_in();
|
||||||
std::memmove(new_client_sock, &client_addr, sizeof(struct 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);
|
_client_data.push_back(new_client_sock);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = _fds_server.size(); i < _client_fds.size(); ++i) {
|
for (size_t i = _fds_server.size(); i < _client_fds.size(); ++i) {
|
||||||
std::cout << i << std::endl;
|
|
||||||
if (_client_fds[i].revents & POLLIN) {
|
if (_client_fds[i].revents & POLLIN) {
|
||||||
std::cout << _client_fds.size() << " " << _client_data.size() << std::endl;
|
if (_handle_client(_client_fds[i], _client_data[i])) {
|
||||||
std::cout << "tamere ==== " << _client_data[i] << std::endl;
|
|
||||||
std::cout << i << std::endl;
|
|
||||||
if (!_handle_client(_client_fds[i], _client_data[i])) {
|
|
||||||
close(_client_fds[i].fd);
|
close(_client_fds[i].fd);
|
||||||
_client_fds.erase(_client_fds.begin() + i);
|
_client_fds.erase(_client_fds.begin() + i);
|
||||||
delete _client_data[i];
|
delete _client_data[i];
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/17 11:58:42 by adjoly #+# #+# */
|
/* 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) {
|
bool Server::_handle_client(struct pollfd &pollfd, sockaddr_in *sock_data) {
|
||||||
try {
|
try {
|
||||||
std::cout << "tamere ==== " << sock_data << std::endl;
|
|
||||||
Client client(pollfd.fd, *sock_data, _conf);
|
Client client(pollfd.fd, *sock_data, _conf);
|
||||||
client.answer();
|
client.answer();
|
||||||
} catch (std::runtime_error &e) {
|
} catch (std::runtime_error &e) {
|
||||||
|
Reference in New Issue
Block a user