def stop(self):
        """Permanently stop sending heartbeats."""
        if not self.stopped:
            self.stopped = True
            if self.pendingHeartbeat is not None:
                self.pendingHeartbeat.cancel()
                self.pendingHeartbeat = None