This was true even when service_check was false. The reason for this is that
we are using nonblocking sockets. Waiting for the socket to be open for write
is necessary to make sure that the error is available, but one still has to
retrieve it using getsockopt. Note that this commit explicitly checks for
ECONNREFUSED, but there could be other errors available (if there is no error,
errno will be equal to 0).