Skip to content

Commit

Permalink
Add t_event_data *epoll_event_info in ConnStream.hpp object. So we ca…
Browse files Browse the repository at this point in the history
…n free it later

when needed.
All leaks are solved.
  • Loading branch information
Sepulven committed May 18, 2024
1 parent 3885d84 commit 9730f99
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions inc/ConnStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

/*Utils*/
#include <__file_manager_utils.hpp>
#include <__webserv_utils.hpp>

class Req;
class Res;
Expand All @@ -32,6 +33,8 @@ class ConnStream
Req *req;
Res *res;

t_event_data *epoll_event_info;

long long last_action_time;
long long close_conn_time;
long long kill_cgi_time;
Expand Down
1 change: 1 addition & 0 deletions srcs/WebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ void WebServer::accept_connection(int epoll_fd, int fd)
if (epoll_add_fd(epoll_fd, client_fd, event) < 0)
throw Error("Epoll_ctl failed");
this->streams[client_fd] = new ConnStream(client_fd, servers[fd]);
this->streams[client_fd]->epoll_event_info = static_cast<t_event_data*>(event.data.ptr);
}

/*
Expand Down
1 change: 1 addition & 0 deletions srcs/conn/ConnStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ConnStream::~ConnStream()
{
delete this->req;
delete this->res;
delete this->epoll_event_info;
}

void ConnStream::clean_conn()
Expand Down

0 comments on commit 9730f99

Please sign in to comment.