add a (optional) losingfn callback for when a connection state change is detected and we need to give up leadership.