AsyncMessenger: a trivial refactory and a fix

haomai, i fixed in a slightly different way. could you help me look at the updated patch again? thanks.