processedResult<T> method

bool processedResult<T>(
  1. int nodeId,
  2. T result
)

Called when a node has processed an unsolicited request so that any outstanding request waiting for that information can be completed. Returns true if an outstanding request was satisified, else false.

Implementation

bool processedResult<T>(int nodeId, T result) {
  if (T == Type) throw 'missing result type';
  for (int index = 0; index < _resultPool.length; ++index) {
    final request = _resultPool[index];
    if (request.nodeId == nodeId && request.resultKey == T) {
      _resultPool.removeAt(index);
      request.completer.complete(result);
      _startResultTimer();
      return true;
    }
  }
  return false;
}