From 0f6040ecb12a00dc97f372adf35d74483a7c9e87 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Sun, 22 Mar 2015 12:44:32 +0000 Subject: [PATCH] enforce a minimum number of RIs to bundle --- .../java/src/net/i2p/router/web/ReseedBundler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ReseedBundler.java b/apps/routerconsole/java/src/net/i2p/router/web/ReseedBundler.java index 949f2f5dfa..de94af7201 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ReseedBundler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ReseedBundler.java @@ -44,6 +44,7 @@ class ReseedBundler { private final RouterContext _context; private final static String ROUTERINFO_PREFIX = "routerInfo-"; private final static String ROUTERINFO_SUFFIX = ".dat"; + private static final int MINIMUM = 50; public ReseedBundler(RouterContext ctx) { _context = ctx; @@ -118,7 +119,10 @@ class ReseedBundler { } if (toWrite.isEmpty()) - throw new IOException("No router infos to include"); + throw new IOException("No router infos to include. Reseed yourself first."); + if (toWrite.size() < Math.min(count, MINIMUM)) + throw new IOException("Not enough router infos to include, wanted " + count + + " but only found " + toWrite.size() + ". Please try again later."); File rv = new File(_context.getTempDir(), "genreseed-" + _context.random().nextInt() + ".zip"); ZipOutputStream zip = null; -- GitLab