u413-284-si / webserv

This project is about setting up a http web server, providing a static website.
MIT License
0 stars 0 forks source link

Remove client if an error occurs at recv/send #75

Closed u413-284-si closed 1 month ago

u413-284-si commented 1 month ago

use shallCloseConnection boolean

based on eval

gwolf-011235 commented 1 month ago

use shallCloseConnection boolean

Why?

If recv errors with -1 we close fd and set connection status closed:

If send errors with -1 we close fd and set connection status closed:

We could additionally remove the event from epoll, although this should happen automatically.

From man epoll: Will closing a file descriptor cause it to be removed from all epoll interest lists? Yes, but be aware of the following point. [~= if you have two refrences it won't be removed]

u413-284-si commented 1 month ago

Yes, you are right, this point is already handled. Was not fully aware of the closing of fds when an error occurs with recv/send when I was cross-checking the eval sheet. This can be closed, all the better!