What is the technique to shutdown and restart a server without losing connections? Is it just making sure the connection isn't closed or reset before shutting down the server?
* SO_REUSEPORT - not reusing the socket, but allowing multiple sockets to bind to a single port. [1]
* Fork / Exec - have a parent process signal the child process to terminate after it has spun up a new version and the new version is accepting connections [2]
[1]: https://lwn.net/Articles/542629/
[2]: https://news.ycombinator.com/item?id=9694339Perhaps there's a kernel-level API that could be added to allow sockets to be snatched or handed over to a new process. That is, honestly, probably the more apropos solution. The fact that sockets act as a kind of lock is an implementation detail.