cancel method

Cancels the scanning task.

Implementation

Future<PortScannerTaskReport> cancel() async {
  if (!_isRunning) {
    throw PortScannerTaskException('UdpScannerTask can\'t be cancelled');
  }
  for (var scanner in _scanners) {
    scanner.cancel();
  }
  _isRunning = false;
  var scanReport = Report(host, ports, status: ReportStatus.cancelled);
  return _reportToPortScannerTaskReport(scanReport);
}