During master restart only attempt to reconnect the slave after the master has finished restarting. (cherry picked from commit 48e19c58)