Do check the used file descriptors only in debug configuration.
Explicitly make accepted socket a blocking.

On Mac they are sometimes non-blocking on their own.