diff --git a/TODO b/TODO index 0315d0eb..4e0318e1 100644 --- a/TODO +++ b/TODO @@ -13,7 +13,6 @@ Before 3.0: * public XSL for XMLExporter * Easier adding/removing of columns to the result table (without resetting the results) * top-level exception handler for NoClassDefFoundErrors, etc -* bug: rescanning when display=open does not properly render dead hosts Later: diff --git a/src/net/azib/ipscan/gui/ResultTable.java b/src/net/azib/ipscan/gui/ResultTable.java index 2f361aa3..eefb4983 100755 --- a/src/net/azib/ipscan/gui/ResultTable.java +++ b/src/net/azib/ipscan/gui/ResultTable.java @@ -188,7 +188,7 @@ public class ResultTable extends Table implements FetcherRegistryUpdateListener, // we need to remove the elements from our real storage as well scanningResults.remove(indices); super.remove(indices); - // TODO: this is VERY slow if there a lot of items (eg 300k), due to the Control.sort() that is called inside to sort the indices + // TODO: this is VERY slow if there are a lot of items (eg 300k), due to the Control.sort() that is called inside to sort the indices } public void removeAll() { diff --git a/src/net/azib/ipscan/gui/actions/StartStopScanningAction.java b/src/net/azib/ipscan/gui/actions/StartStopScanningAction.java index 34363988..9ee0d131 100755 --- a/src/net/azib/ipscan/gui/actions/StartStopScanningAction.java +++ b/src/net/azib/ipscan/gui/actions/StartStopScanningAction.java @@ -9,6 +9,7 @@ import java.net.InetAddress; import net.azib.ipscan.config.GUIConfig; import net.azib.ipscan.config.Labels; +import net.azib.ipscan.config.GUIConfig.DisplayMethod; import net.azib.ipscan.core.ScannerDispatcherThread; import net.azib.ipscan.core.ScannerDispatcherThreadFactory; import net.azib.ipscan.core.ScanningProgressCallback; @@ -153,7 +154,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr // start the scan from scratch! resultTable.removeAll(); try { - scannerThread = scannerThreadFactory.createScannerThread(feederRegistry.createFeeder(), StartStopScanningAction.this, createResultsCallback()); + scannerThread = scannerThreadFactory.createScannerThread(feederRegistry.createFeeder(), StartStopScanningAction.this, createResultsCallback(state)); stateMachine.startScanning(); mainWindowTitle = statusBar.getShell().getText(); } @@ -166,7 +167,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr // restart the scanning - rescan resultTable.resetSelection(); try { - scannerThread = scannerThreadFactory.createScannerThread(feederRegistry.createRescanFeeder(resultTable.getSelection()), StartStopScanningAction.this, createResultsCallback()); + scannerThread = scannerThreadFactory.createScannerThread(feederRegistry.createRescanFeeder(resultTable.getSelection()), StartStopScanningAction.this, createResultsCallback(state)); stateMachine.startScanning(); mainWindowTitle = statusBar.getShell().getText(); } @@ -194,9 +195,10 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr /** * @return the appropriate ResultsCallback instance, depending on the configured display method. */ - private final ScanningResultCallback createResultsCallback() { - switch (guiConfig.displayMethod) { - default: return new ScanningResultCallback() { + private final ScanningResultCallback createResultsCallback(ScanningState state) { + // rescanning must follow the same strategy of displaying all hosts (even the dead ones), because the results are already in the list + if (guiConfig.displayMethod == DisplayMethod.ALL || state == ScanningState.RESTARTING) { + return new ScanningResultCallback() { public void prepareForResults(ScanningResult result) { resultTable.addOrUpdateResultRow(result); } @@ -204,8 +206,9 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr resultTable.addOrUpdateResultRow(result); } }; - - case ALIVE: return new ScanningResultCallback() { + } + if (guiConfig.displayMethod == DisplayMethod.ALIVE) { + return new ScanningResultCallback() { public void prepareForResults(ScanningResult result) { } public void consumeResults(ScanningResult result) { @@ -213,8 +216,9 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr resultTable.addOrUpdateResultRow(result); } }; - - case PORTS: return new ScanningResultCallback() { + } + if (guiConfig.displayMethod == DisplayMethod.PORTS) { + return new ScanningResultCallback() { public void prepareForResults(ScanningResult result) { } public void consumeResults(ScanningResult result) { @@ -223,6 +227,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr } }; } + throw new UnsupportedOperationException(guiConfig.displayMethod.toString()); } public void updateProgress(final InetAddress currentAddress, final int runningThreads, final int percentageComplete) {