c-cube / tiny_httpd

Minimal HTTP server using good old threads + blocking IO, with a small request router.
https://c-cube.github.io/tiny_httpd
75 stars 11 forks source link

fix: do not block in `accept` #73

Closed c-cube closed 9 months ago

c-cube commented 9 months ago

cc @vphantom ?

vphantom commented 9 months ago

You no longer enforce a maximum number of concurrent connections?

vphantom commented 9 months ago

Sorry sorry, I was just looking at the diff lines. I guess you're changing your multi-threading strategy if you're going from blocking to non-blocking there. I don't really know what I should be evaluating here.

c-cube commented 9 months ago

Oh it's only the accept loop that uses select, so that it's not blocked forever in case we want to stop the server. In particular, stop should now work after 1s even if no new client connects.

vphantom commented 9 months ago

Oh! I forgot that the graceful shutdown was still an issue. (I've been neck-deep in unrelated work for so long…) For sure stopping the accept loop as soon as the signal is received, and not after the next client is accepted, is a much more predictable behavior.