Clean up client's refreshMetadata function

- As I discovered while investigating additional issues from #213, I made a
  stupid in 1b465e7 and kept returning an error in the case where we ran out of
  leader-election retries, despite *explicitly stating in the commit message*
  that the whole point was to stop doing that.
- Simplify and reorganize flow control in several places.
- Clean up and improve log messages.

@wvanbergen @mkobetic @graemej