code: private boolean inWindow(DatanodeDescriptor first, DatanodeDescriptor testing) {
  
      readLock();
      try {
        RackRingInfo rackInfo = racksMap.get(first.getNetworkLocation());
        assert (rackInfo != null);
  
        Integer machineId = rackInfo.findNode(first);
        assert (machineId != null);
  
        final int rackWindowStart = rackInfo.index;
  
        final RackRingInfo rackTest = racksMap.get(testing.getNetworkLocation());
        assert (rackTest != null);
  
        final int rackDist = (rackTest.index - rackWindowStart + racks.size())
            % racks.size();
  
        if (rackDist < rackWindow + 1 && rackTest.index != rackInfo.index) {
          // inside rack window
          final Integer idFirst = rackInfo.findNode(first);
          assert (idFirst != null);
  
          final int sizeFirstRack = rackInfo.rackNodes.size();
          final int sizeTestRack = rackTest.rackNodes.size();
  
          final int start = idFirst * sizeTestRack / sizeFirstRack;
          final Integer idTest = rackTest.findNode(testing);
          assert (idTest != null);
  
          final int dist = (idTest - start + sizeTestRack) % sizeTestRack;
  
          if (dist < machineWindow) { // inside machine Window
            return true;
          }
        }
  
        return false;
      } finally {
        readUnlock();
      }
    }
docs: Verifies if testing node is within right windows of first node
  @param first first node being considered
  @param testing node we are testing to check if it is within window or not
  @return We return true if it is successful, and not otherwise