Implement graceful shutdown
Hi! This PR attempts to implement per the recommendation in this comment https://github.com/jonashaag/bjoern/issues/91#issuecomment-493710529. The commit message provides more detail on exactly
Note that one distinct difference from the suggested implementation is that the listener socket is closed after the backlog is drained. For my use case (running many instances of my HTTP server using SO_REUSEPORT) this works better, as it will ensure that any new connections will go to other instances ASAP and ensure this given instance can shutdown relatively quickly. Based on further discussion on the issue, I think this would be the most beneficial behavior for others too. If you'd like that behavior to be configurable as well, just let me know and I can add another config flag for it.
(hopefully) fixes #91.
@nhoad are you planning to work on this some more?
I'm happy with the branch as it is, but if you'd like me to make any changes just let me know 😄