Fix up issues found while testing resource_discovery. In particular state
isn't being properly tracked when messages come in on the message queue.