jeremycw / httpserver.h

Single header library for writing non-blocking HTTP servers in C
MIT License
1.78k stars 143 forks source link

Option to break the epoll main loop #56

Open david20160 opened 3 years ago

david20160 commented 3 years ago

Hello,

In order to exit from the server cleaning the way, may be doing this change in the line 1700:

while (1) {

change to

int nev = 0;
while (1) {
    if (nev != -1) break;
    [delete int from the next line]

To quit the loop only it is needed:

int res = epoll_ctl (server->loop, EPOLL_CTL_DEL, 1, NULL);
close (server->loop);

It can be more stylished but works.

Yasha-ops commented 9 months ago

How do you handle memory leaks after the close ?