7.5 years to find out how to close a file descriptor in a multithreaded process
twitter.com
twitter.com
So really the hard part was realizing that you can use MSG_PEEK since it's guaranteed to not have side effects (and with a random cookie can be used to identify whether a descriptor is "our" socket).