I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 4f3c15eb authored by zzz's avatar zzz
Browse files

use HostsTxtNamingService if default fails to initialize

parent c8397990
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,7 @@ public abstract class NamingService { ...@@ -36,6 +36,7 @@ public abstract class NamingService {
/** what classname should be used as the naming service impl? */ /** what classname should be used as the naming service impl? */
public static final String PROP_IMPL = "i2p.naming.impl"; public static final String PROP_IMPL = "i2p.naming.impl";
private static final String DEFAULT_IMPL = "net.i2p.client.naming.BlockfileNamingService"; private static final String DEFAULT_IMPL = "net.i2p.client.naming.BlockfileNamingService";
private static final String BACKUP_IMPL = "net.i2p.client.naming.HostsTxtNamingService";
/** /**
* The naming service should only be constructed and accessed through the * The naming service should only be constructed and accessed through the
...@@ -434,8 +435,14 @@ public abstract class NamingService { ...@@ -434,8 +435,14 @@ public abstract class NamingService {
instance = (NamingService)con.newInstance(new Object[] { context }); instance = (NamingService)con.newInstance(new Object[] { context });
} catch (Exception ex) { } catch (Exception ex) {
Log log = context.logManager().getLog(NamingService.class); Log log = context.logManager().getLog(NamingService.class);
log.error("Cannot load naming service " + impl + ", only .b32.i2p lookups will succeed", ex); // Blockfile may throw RuntimeException but HostsTxt won't
instance = new DummyNamingService(context); // fallback if (!impl.equals(BACKUP_IMPL)) {
log.error("Cannot load naming service " + impl + ", using HostsTxtNamingService", ex);
instance = new HostsTxtNamingService(context);
} else {
log.error("Cannot load naming service " + impl + ", only .b32.i2p lookups will succeed", ex);
instance = new DummyNamingService(context);
}
} }
return instance; return instance;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment