docs: public void cancel() {
        if (!isCancelled) {
           isCancelled = true;
  
           IntSet segmentsCopy = getUnfinishedSegments();
           synchronized (segments) {
              unfinishedSegments.clear();
           }
           if (trace) {
              log.tracef("Cancelling inbound state transfer from %s with unfinished segments %s", source, segmentsCopy);
           }
  
           sendCancelCommand(segmentsCopy);
  
           notifyCompletion(false);
        }
     }