Refactored async resolver code flow

non introduced by this PR but, I noticed that this reads memory out of bounds which makes ASAN unhappy. Use strncmp ?