File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 55#include < fcntl.h>
66#include < unistd.h>
77
8+ #include < iostream>
9+
810void Client::set_handler (Handler* handler)
911{
1012 handler_ = handler;
@@ -46,6 +48,7 @@ Client::Client(int fd, const sockaddr_in& addr)
4648
4749{
4850 set_nonblocking ();
51+ std::cout << " Client constructor called" << std::endl;
4952}
5053
5154Client::~Client ()
@@ -56,6 +59,7 @@ Client::~Client()
5659 if (handler_) {
5760 delete (handler_);
5861 }
62+ std::cout << " Client destructor called" << std::endl;
5963}
6064
6165void Client::set_nonblocking ()
Original file line number Diff line number Diff line change @@ -231,13 +231,16 @@ void Server::send_response(Client* conn)
231231 conn->flush_send_bufffer ();
232232
233233 if (conn->send_buffer ().empty ()) {
234+ std::cout << " calling on writable" << std::endl;
234235 conn->on_writable ();
235236 }
236- if (conn->handler_is_done () && conn->send_buffer ().empty ()) {
237+ // if (conn->handler_is_done() && conn->send_buffer().empty()) {
238+ if (conn->handler_is_done ()) {
237239 // assuming HTTP/1.0 for testing
238240 if (epoll_ctl (epoll_fd_, EPOLL_CTL_DEL, conn->fd (), NULL ) == -1 ) {
239241 throw UnrecoverableError (" epoll_ctl" , errno);
240242 }
243+ std::cout << " attempting to remove the connection" << std::endl;
241244 remove_connection (conn);
242245 }
243246}
You can’t perform that action at this time.
0 commit comments