- Deal with conflicting bouncycastle libs take #2

- Disable NTCP
- Shuffle the startup/shutdown tasks some
This commit is contained in:
zzz
2009-03-13 21:49:27 +00:00
parent b8f22bf3bf
commit 5022575429
6 changed files with 24 additions and 11 deletions

View File

@@ -5,3 +5,5 @@ router.decayingBloomFilterM=20
stat.full=false stat.full=false
# no I2CP # no I2CP
i2p.dummyClientFacade=true i2p.dummyClientFacade=true
# for now
i2np.ntcp.enable=false

View File

@@ -12,6 +12,7 @@ import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import net.i2p.router.Router; import net.i2p.router.Router;
import net.i2p.router.web.ContextHelper;
import net.i2p.router.web.ReseedChecker; import net.i2p.router.web.ReseedChecker;
import net.i2p.util.I2PFile; import net.i2p.util.I2PFile;
@@ -29,11 +30,6 @@ public class I2PAndroid extends Activity
_context = this; // Activity extends Context _context = this; // Activity extends Context
debugStuff(); debugStuff();
initialize(); initialize();
Router.main(null);
System.err.println("Router.main finished");
ReseedChecker.checkReseed();
} }
public void onRestart() public void onRestart()
@@ -42,6 +38,16 @@ public class I2PAndroid extends Activity
super.onRestart(); super.onRestart();
} }
public void onStart()
{
System.err.println("onStart called");
super.onStart();
Router.main(null);
System.err.println("Router.main finished");
ReseedChecker.checkReseed();
}
public void onResume() public void onResume()
{ {
System.err.println("onResume called"); System.err.println("onResume called");
@@ -58,6 +64,9 @@ public class I2PAndroid extends Activity
{ {
System.err.println("onStop called"); System.err.println("onStop called");
super.onStop(); super.onStop();
// shutdown() doesn't return so use shutdownGracefully()
ContextHelper.getContext(null).router().shutdownGracefully(Router.EXIT_HARD);
System.err.println("shutdown complete");
} }
public void onDestroy() public void onDestroy()

View File

@@ -30,6 +30,8 @@ public class ReseedChecker {
System.err.println("Yes, reseeding now"); System.err.println("Yes, reseeding now");
ReseedHandler reseedHandler = new ReseedHandler(); ReseedHandler reseedHandler = new ReseedHandler();
reseedHandler.requestReseed(); reseedHandler.requestReseed();
} else {
System.err.println("No, we have " + names.length + " routers in the netDb");
} }
} }
} }

View File

@@ -5,7 +5,7 @@ import java.util.List;
import net.i2p.data.Hash; import net.i2p.data.Hash;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
class ContextHelper { public class ContextHelper {
public static RouterContext getContext(String contextId) { public static RouterContext getContext(String contextId) {
List contexts = RouterContext.listContexts(); List contexts = RouterContext.listContexts();
if ( (contexts == null) || (contexts.size() <= 0) ) if ( (contexts == null) || (contexts.size() <= 0) )

View File

@@ -20,10 +20,10 @@ public class HMAC256Generator extends HMACGenerator {
public HMAC256Generator(I2PAppContext context) { super(context); } public HMAC256Generator(I2PAppContext context) { super(context); }
@Override @Override
protected Mac acquire() { protected I2PHMac acquire() {
synchronized (_available) { synchronized (_available) {
if (_available.size() > 0) if (_available.size() > 0)
return (Mac)_available.remove(0); return (I2PHMac)_available.remove(0);
} }
// the HMAC is hardcoded to use SHA256 digest size // the HMAC is hardcoded to use SHA256 digest size
// for backwards compatability. next time we have a backwards // for backwards compatability. next time we have a backwards

View File

@@ -50,7 +50,7 @@ public class HMACGenerator {
if ((key == null) || (key.getData() == null) || (data == null)) if ((key == null) || (key.getData() == null) || (data == null))
throw new NullPointerException("Null arguments for HMAC"); throw new NullPointerException("Null arguments for HMAC");
Mac mac = acquire(); I2PHMac mac = acquire();
mac.init(key.getData()); mac.init(key.getData());
mac.update(data, offset, length); mac.update(data, offset, length);
//byte rv[] = new byte[Hash.HASH_LENGTH]; //byte rv[] = new byte[Hash.HASH_LENGTH];
@@ -87,10 +87,10 @@ public class HMACGenerator {
return eq; return eq;
} }
protected Mac acquire() { protected I2PHMac acquire() {
synchronized (_available) { synchronized (_available) {
if (_available.size() > 0) if (_available.size() > 0)
return (Mac)_available.remove(0); return (I2PHMac)_available.remove(0);
} }
// the HMAC is hardcoded to use SHA256 digest size // the HMAC is hardcoded to use SHA256 digest size
// for backwards compatability. next time we have a backwards // for backwards compatability. next time we have a backwards