From c1fec63d9d2fbbe9ee279f53b650906616d6f426 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sun, 15 Mar 2015 14:10:30 -0700 Subject: [PATCH] Fixed --max-routes --- commands/run_cmd.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/commands/run_cmd.py b/commands/run_cmd.py index 9aa20611..0f796788 100644 --- a/commands/run_cmd.py +++ b/commands/run_cmd.py @@ -1019,14 +1019,15 @@ def run(results, cmdenv, tdb): elif len(viaSet) > cmdenv.adhocHops: restrictTo = viaSet - if cmdenv.maxRoutes and hopNo >= 1: - routes = routes[:cmdenv.maxRoutes] - - if pruneMod and hopNo + 1 >= cmdenv.pruneHops and len(routes) > 10: + if hopNo >= 1 and cmdenv.maxRoutes or pruneMod: routes.sort() - crop = int(len(routes) * pruneMod) - routes = routes[:-crop] - cmdenv.NOTE("Pruned {} origins", crop) + if cmdenv.maxRoutes: + routes = routes[:cmdenv.maxRoutes] + + if pruneMod and hopNo + 1 >= cmdenv.pruneHops and len(routes) > 10: + crop = int(len(routes) * pruneMod) + routes = routes[:-crop] + cmdenv.NOTE("Pruned {} origins", crop) if cmdenv.progress: print("* Hop {:3n}: {:.>10n} origins".format(hopNo+1, len(routes)))