Move the SSL setup and host/port list checking to daemon_serviceloop().
That:
1) arranges that it's done only in one code path;
2) arranges that it not be done in the main connection-accepting
thread/process if this isn't an inetd-style daemon;
3) means that we're doing the host/port list checking in
inetd-style daemons - we weren't doing it before;
4) means that we're doing both of them after we've turned off
non-blocking mode on Windows, not before - doing it before
may cause the SSL setup and sending a host/port list check
error not to work (as we won't block waiting for input or
waiting for buffer space to be available for output).
Fix the file descriptor handling for inetd-style daemons while we're at
it; we should redirect the standard error to /dev/null - it's not
guaranteed to, for example, go to a daemon that reads your error
messages and logs them, and it could be going over the connection, which
would be a problem.
Close the control socket with sock_close() after daemon_serviceloop()
returns, in case shutting down the write side is necessary to have the
connection shut down cleanly.