Avoid duplicate worker registrations

The gist is that we only reconnect to the master we've been
communicating with instead of making a registration request
to all known masters. More details in the code comments.