forked from I2P_Developers/i2p.i2p
* Startup:
- Don't die horribly if there is a router.info file but no router.keys file http://forum.i2p/viewtopic.php?t=4424 - Log tweaks
This commit is contained in:
@ -98,9 +98,9 @@ public class CreateRouterInfoJob extends JobImpl {
|
||||
|
||||
_log.info("Router info created and stored at " + ifile.getAbsolutePath() + " with private keys stored at " + kfile.getAbsolutePath() + " [" + info + "]");
|
||||
} catch (DataFormatException dfe) {
|
||||
_log.error("Error building the new router information", dfe);
|
||||
_log.log(Log.CRIT, "Error building the new router information", dfe);
|
||||
} catch (IOException ioe) {
|
||||
_log.error("Error writing out the new router information", ioe);
|
||||
_log.log(Log.CRIT, "Error writing out the new router information", ioe);
|
||||
} finally {
|
||||
if (fos1 != null) try { fos1.close(); } catch (IOException ioe) {}
|
||||
if (fos2 != null) try { fos2.close(); } catch (IOException ioe) {}
|
||||
|
@ -68,11 +68,18 @@ public class LoadRouterInfoJob extends JobImpl {
|
||||
FileInputStream fis1 = null;
|
||||
FileInputStream fis2 = null;
|
||||
try {
|
||||
if (_infoExists) {
|
||||
// if we have a routerinfo but no keys, things go bad in a hurry:
|
||||
// CRIT ...rkdb.PublishLocalRouterInfoJob: Internal error - signing private key not known? rescheduling publish for 30s
|
||||
// CRIT net.i2p.router.Router : Internal error - signing private key not known? wtf
|
||||
// CRIT ...sport.udp.EstablishmentManager: Error in the establisher java.lang.NullPointerException
|
||||
// at net.i2p.router.transport.udp.PacketBuilder.buildSessionConfirmedPacket(PacketBuilder.java:574)
|
||||
// so pretend the RI isn't there if there is no keyfile
|
||||
if (_infoExists && _keysExist) {
|
||||
fis1 = new FileInputStream(rif);
|
||||
info = new RouterInfo();
|
||||
info.readBytes(fis1);
|
||||
_log.debug("Reading in routerInfo from " + rif.getAbsolutePath() + " and it has " + info.getAddresses().size() + " addresses");
|
||||
_us = info;
|
||||
}
|
||||
|
||||
if (_keysExist) {
|
||||
@ -91,17 +98,15 @@ public class LoadRouterInfoJob extends JobImpl {
|
||||
getContext().keyManager().setPublicKey(pubkey); //info.getIdentity().getPublicKey());
|
||||
getContext().keyManager().setSigningPublicKey(signingPubKey); // info.getIdentity().getSigningPublicKey());
|
||||
}
|
||||
|
||||
_us = info;
|
||||
} catch (IOException ioe) {
|
||||
_log.error("Error reading the router info from " + rif.getAbsolutePath() + " and the keys from " + rkf.getAbsolutePath(), ioe);
|
||||
_log.log(Log.CRIT, "Error reading the router info from " + rif.getAbsolutePath() + " and the keys from " + rkf.getAbsolutePath(), ioe);
|
||||
_us = null;
|
||||
rif.delete();
|
||||
rkf.delete();
|
||||
_infoExists = false;
|
||||
_keysExist = false;
|
||||
} catch (DataFormatException dfe) {
|
||||
_log.error("Corrupt router info or keys at " + rif.getAbsolutePath() + " / " + rkf.getAbsolutePath(), dfe);
|
||||
_log.log(Log.CRIT, "Corrupt router info or keys at " + rif.getAbsolutePath() + " / " + rkf.getAbsolutePath(), dfe);
|
||||
_us = null;
|
||||
rif.delete();
|
||||
rkf.delete();
|
||||
|
@ -107,7 +107,7 @@ public class RebuildRouterInfoJob extends JobImpl {
|
||||
ident.setSigningPublicKey(signingPubKey);
|
||||
info.setIdentity(ident);
|
||||
} catch (Exception e) {
|
||||
_log.error("Error reading in the key data from " + keyFile.getAbsolutePath(), e);
|
||||
_log.log(Log.CRIT, "Error reading in the key data from " + keyFile.getAbsolutePath(), e);
|
||||
if (fis != null) try { fis.close(); } catch (IOException ioe) {}
|
||||
fis = null;
|
||||
keyFile.delete();
|
||||
@ -129,7 +129,7 @@ public class RebuildRouterInfoJob extends JobImpl {
|
||||
|
||||
info.sign(getContext().keyManager().getSigningPrivateKey());
|
||||
} catch (DataFormatException dfe) {
|
||||
_log.error("Error rebuilding the new router info", dfe);
|
||||
_log.log(Log.CRIT, "Error rebuilding the new router info", dfe);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -138,9 +138,9 @@ public class RebuildRouterInfoJob extends JobImpl {
|
||||
fos = new FileOutputStream(infoFile);
|
||||
info.writeBytes(fos);
|
||||
} catch (DataFormatException dfe) {
|
||||
_log.error("Error rebuilding the router information", dfe);
|
||||
_log.log(Log.CRIT, "Error rebuilding the router information", dfe);
|
||||
} catch (IOException ioe) {
|
||||
_log.error("Error writing out the rebuilt router information", ioe);
|
||||
_log.log(Log.CRIT, "Error writing out the rebuilt router information", ioe);
|
||||
} finally {
|
||||
if (fos != null) try { fos.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user