Backport "afsocket: handle DNS failures as if it was a connection failure".