Fixed a bug that can cause the Master to produce a growing number of
leader detection loops.

From: Jiang Yan Xu <yan@jxu.me>
Review: https://reviews.apache.org/r/16333