pullXXifps method

Future<Uint8List> pullXXifps(
  1. String xxInt,
  2. String shortLink,
  3. String cid
)

Implementation

Future<Uint8List> pullXXifps(
    String xxInt, String shortLink, String cid) async {
  //List<int> xx = attachment.sublist(attachment.length - 8, attachment.length);
  //String xxi = HEX.encode(xx);
  //if (_xxStash[xxInt] != null) return _xxStash[xxInt]!;
  //if (!molo.ghostMode) {
  if (_brokenCIDs.contains(cid)) return Uint8List(0);
  _xxToCid[xxInt] = cid;
  if (_pullingXIP.contains(xxInt)) return Uint8List(0);
  _pullingXIP.add(xxInt);
  final value = _io?.readCid(
      cid); /*.then((value) {
        if (value != null) {
          if (value.isNotEmpty) {
            _xxWants.remove(xxInt);
            _diskFetch.remove(xxInt);
            _xxStash[xxInt] = value.buffer.asUint8List();
            return _xxStash[xxInt]!;
          }
        } else {
          return pullCidFromIPFS(cid, xxInt);
        }
      });*/
  if (value != null) {
    _pullingXIP.remove(xxInt);
    return value;
  }

  //broadcastXXwantOverUDP(xxInt);

  pullCidFromIPFS(cid, xxInt).then((value) {
    _pullingXIP.remove(xxInt);
    //puts in the xxcache
  });
  return Uint8List(0);
/*
  if (!_diskFetch.contains(xxInt)) {
    _diskFetch.add(xxInt);
    try {
      var value = await _io?.readXX(xxInt).then((value) {
        if (value != null) {
          if (value.isNotEmpty) {
            _xxWants.remove(xxInt);
            _diskFetch.remove(xxInt);
            _xxStash[xxInt] = value.buffer.asUint8List();
            return _xxStash[xxInt]!;
          }
        } else {
          return pullCidFromIPFS(cid, xxInt);
        }
      });
      //return Uint8List(0);
      //});
    } catch (e) {
      //return null;
      return pullCidFromIPFS(cid, xxInt);
    }
  }

  return pullCidFromIPFS(cid, xxInt);

  if (_xxWants.contains(xxInt)) {
    //dont allow multi reqs for the same item

    return Uint8List(0);
  }
*/
  //_xxWants.add(xxInt);

  /*if (_pulling == 0) {
    _pulling = now;
  } else {
    if (now - _pulling < 500) {
      return Uint8List(0);
    }
    _pulling = now;
  }*/

  /*bool pl = false;
  Random rnd = new Random();
  var r = 100 + rnd.nextInt(600 - 100);
  Timer(Duration(milliseconds: r), () {*/
}