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

Skip to content
Snippets Groups Projects
Commit 3a7f4331 authored by zzz's avatar zzz
Browse files

- Enable UPnP

- Increase max NTCP connections
- Delete old wrapper.log at startup
- Spoof network status on emulator
- Increase client start delay
- Disable shared clients
- Stop LogWriter from starting a new App context at shutdown
- LogWriter tweaks
- Logging tweaks
parent 2ee5d5f0
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,9 @@ The i2p source must be installed in ../i2p.i2p ...@@ -39,6 +39,9 @@ The i2p source must be installed in ../i2p.i2p
../android-sdk-linux_86/tools/emulator -avd i2p & ../android-sdk-linux_86/tools/emulator -avd i2p &
# or to talk to a real phone in debug mode: # or to talk to a real phone in debug mode:
# You have to do this if you get a permission error -
# Stop ddms, unplug the phone, do the following,
# then plug in the phone, then start ddms
adb kill-server adb kill-server
sudo adb start-server sudo adb start-server
adb devices adb devices
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
tunnel.0.name=I2P HTTP Proxy tunnel.0.name=I2P HTTP Proxy
tunnel.0.description=HTTP proxy for browsing eepsites and the web tunnel.0.description=HTTP proxy for browsing eepsites and the web
tunnel.0.type=httpclient tunnel.0.type=httpclient
tunnel.0.sharedClient=true tunnel.0.sharedClient=false
tunnel.0.interface=127.0.0.1 tunnel.0.interface=127.0.0.1
tunnel.0.listenPort=4444 tunnel.0.listenPort=4444
tunnel.0.proxyList=false.i2p tunnel.0.proxyList=false.i2p
tunnel.0.i2cpHost=127.0.0.1 tunnel.0.i2cpHost=127.0.0.1
tunnel.0.i2cpPort=7654 tunnel.0.i2cpPort=7654
tunnel.0.option.inbound.nickname=shared clients tunnel.0.option.inbound.nickname=HTTP Proxy
tunnel.0.option.outbound.nickname=shared clients tunnel.0.option.outbound.nickname=HTTP Proxy
#tunnel.0.option.i2cp.delayOpen=true #tunnel.0.option.i2cp.delayOpen=true
tunnel.0.option.i2cp.reduceIdleTime=600000 tunnel.0.option.i2cp.reduceIdleTime=600000
tunnel.0.option.i2cp.reduceOnIdle=true tunnel.0.option.i2cp.reduceOnIdle=true
...@@ -25,7 +25,7 @@ tunnel.0.startOnLoad=true ...@@ -25,7 +25,7 @@ tunnel.0.startOnLoad=true
tunnel.1.name=IRC Proxy tunnel.1.name=IRC Proxy
tunnel.1.description=IRC proxy to access anonymous IRC servers tunnel.1.description=IRC proxy to access anonymous IRC servers
tunnel.1.type=ircclient tunnel.1.type=ircclient
tunnel.1.sharedClient=true tunnel.1.sharedClient=false
tunnel.1.interface=127.0.0.1 tunnel.1.interface=127.0.0.1
tunnel.1.listenPort=6668 tunnel.1.listenPort=6668
tunnel.1.targetDestination=irc.postman.i2p,irc.freshcoffee.i2p tunnel.1.targetDestination=irc.postman.i2p,irc.freshcoffee.i2p
......
logger.dateFormat=MM/dd HH:mm:ss.SSS
logger.defaultLevel=INFO logger.defaultLevel=INFO
logger.record.net.i2p.router.peerManager.ProfileOrganizer=WARN logger.displayOnScreen=true
logger.logFileSize=64k
logger.logRotationLimit=2
logger.minimumOnScreenLevel=WARN
logger.record.net.i2p.router.networkdb=WARN
logger.record.net.i2p.router.peermanager=WARN
logger.record.net.i2p.router.peermanager.ProfileOrganizer=WARN
logger.record.net.i2p.router.transport=WARN logger.record.net.i2p.router.transport=WARN
logger.record.net.i2p.router.transport.FIFOBandwidthRefiller=ERROR logger.record.net.i2p.router.transport.FIFOBandwidthRefiller=ERROR
logger.record.net.i2p.router.tunnel=WARN
logger.record.net.i2p.stat.Rate=ERROR logger.record.net.i2p.stat.Rate=ERROR
logger.record.net.i2p.util.LogManager=WARN logger.record.net.i2p.util.LogManager=WARN
logger.record.net.i2p.util.LogWriter=WARN logger.record.net.i2p.util.LogWriter=WARN
logger.record.net.i2p.util.NativeBigInteger=DEBUG logger.record.net.i2p.util.NativeBigInteger=DEBUG
logger.record.net.org.cybergarage.util.debug=DEBUG
...@@ -37,7 +37,7 @@ i2np.bandwidth.outboundKBytesPerSecond=30 ...@@ -37,7 +37,7 @@ i2np.bandwidth.outboundKBytesPerSecond=30
# NTCP # NTCP
# #
#i2np.ntcp.enable=false #i2np.ntcp.enable=false
i2np.ntcp.maxConnections=12 i2np.ntcp.maxConnections=24
# #
# UDP disabled for now # UDP disabled for now
# #
...@@ -48,5 +48,5 @@ i2np.udp.maxConnections=12 ...@@ -48,5 +48,5 @@ i2np.udp.maxConnections=12
#i2p.vmCommSystem=true #i2p.vmCommSystem=true
# #
# not on android # not on android
i2np.upnp.enable=false i2np.upnp.enable=true
routerconsole.geoip.enable=false routerconsole.geoip.enable=false
...@@ -8,6 +8,7 @@ import android.content.IntentFilter; ...@@ -8,6 +8,7 @@ import android.content.IntentFilter;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.os.Build;
import android.os.IBinder; import android.os.IBinder;
import net.i2p.android.router.binder.RouterBinder; import net.i2p.android.router.binder.RouterBinder;
...@@ -20,6 +21,7 @@ public class I2PReceiver extends BroadcastReceiver { ...@@ -20,6 +21,7 @@ public class I2PReceiver extends BroadcastReceiver {
private int _unconnectedCount; private int _unconnectedCount;
private RouterService _routerService; private RouterService _routerService;
private ServiceConnection _connection; private ServiceConnection _connection;
private static final boolean _isEmulator = Build.MODEL.equals("sdk");
/** /**
* Registers itself * Registers itself
...@@ -78,6 +80,9 @@ public class I2PReceiver extends BroadcastReceiver { ...@@ -78,6 +80,9 @@ public class I2PReceiver extends BroadcastReceiver {
} }
public boolean isConnected() { public boolean isConnected() {
// emulator always returns null NetworkInfo
if (_isEmulator)
return true;
NetworkInfo current = getInfo(); NetworkInfo current = getInfo();
return current != null && current.isConnected(); return current != null && current.isConnected();
} }
......
...@@ -83,6 +83,8 @@ class Init { ...@@ -83,6 +83,8 @@ class Init {
mergeResourceToFile(R.raw.hosts_txt, "hosts.txt", null); mergeResourceToFile(R.raw.hosts_txt, "hosts.txt", null);
copyResourceToFile(R.raw.blocklist_txt, "blocklist.txt"); copyResourceToFile(R.raw.blocklist_txt, "blocklist.txt");
(new File(myDir, "wrapper.log")).delete();
// Set up the locations so Router and WorkingDir can find them // Set up the locations so Router and WorkingDir can find them
System.setProperty("i2p.dir.base", myDir); System.setProperty("i2p.dir.base", myDir);
System.setProperty("i2p.dir.config", myDir); System.setProperty("i2p.dir.config", myDir);
......
...@@ -30,8 +30,8 @@ class LoadClientsJob extends JobImpl { ...@@ -30,8 +30,8 @@ class LoadClientsJob extends JobImpl {
private Thread _fetcherThread; private Thread _fetcherThread;
/** this is the delay to load the clients. There are additional delays e.g. in i2ptunnel.config */ /** this is the delay to load (and start) the clients. */
private static final long LOAD_DELAY = 10*1000; private static final long LOAD_DELAY = 2*60*1000;
public LoadClientsJob(RouterContext ctx) { public LoadClientsJob(RouterContext ctx) {
...@@ -62,8 +62,9 @@ class LoadClientsJob extends JobImpl { ...@@ -62,8 +62,9 @@ class LoadClientsJob extends JobImpl {
public void runJob() { public void runJob() {
System.err.println("Starting i2ptunnel"); System.err.println("Starting i2ptunnel");
TunnelControllerGroup.main(null); TunnelControllerGroup tcg = TunnelControllerGroup.getInstance();
System.err.println("i2ptunnel started"); int sz = tcg.getControllers().size();
System.err.println("i2ptunnel started " + sz + " clients");
getContext().addShutdownTask(new I2PTunnelShutdownHook()); getContext().addShutdownTask(new I2PTunnelShutdownHook());
} }
...@@ -74,7 +75,6 @@ class LoadClientsJob extends JobImpl { ...@@ -74,7 +75,6 @@ class LoadClientsJob extends JobImpl {
System.err.println("i2ptunnel shutdown hook"); System.err.println("i2ptunnel shutdown hook");
if (_fetcherThread != null) if (_fetcherThread != null)
_fetcherThread.interrupt(); _fetcherThread.interrupt();
TunnelControllerGroup.getInstance().unloadControllers();
} }
} }
} }
...@@ -47,6 +47,7 @@ public class RouterService extends Service { ...@@ -47,6 +47,7 @@ public class RouterService extends Service {
System.err.println(this + " onCreate called" + System.err.println(this + " onCreate called" +
" Current state is: " + _state); " Current state is: " + _state);
(new File(getFilesDir(), "wrapper.log")).delete();
_myDir = getFilesDir().getAbsolutePath(); _myDir = getFilesDir().getAbsolutePath();
Init init = new Init(this); Init init = new Init(this);
init.debugStuff(); init.debugStuff();
...@@ -138,17 +139,16 @@ public class RouterService extends Service { ...@@ -138,17 +139,16 @@ public class RouterService extends Service {
} }
} }
/** TODO change to a handler */
private class StatusThread implements Runnable { private class StatusThread implements Runnable {
public void run() { public void run() {
System.err.println(MARKER + this + " status thread started" + System.err.println(MARKER + this + " status thread started" +
" Current state is: " + _state); " Current state is: " + _state);
try {
Thread.sleep(5*1000);
} catch (InterruptedException ie) {}
Router router = _context.router(); Router router = _context.router();
while (_state == State.RUNNING && router.isAlive()) { while (_state == State.RUNNING && router.isAlive()) {
try {
Thread.sleep(15*1000);
} catch (InterruptedException ie) {
break;
}
int active = _context.commSystem().countActivePeers(); int active = _context.commSystem().countActivePeers();
int known = Math.max(_context.netDb().getKnownRouters() - 1, 0); int known = Math.max(_context.netDb().getKnownRouters() - 1, 0);
int inEx = _context.tunnelManager().getFreeTunnelCount(); int inEx = _context.tunnelManager().getFreeTunnelCount();
...@@ -186,8 +186,12 @@ public class RouterService extends Service { ...@@ -186,8 +186,12 @@ public class RouterService extends Service {
" Up " + uptime; " Up " + uptime;
_statusBar.update(status, details); _statusBar.update(status, details);
try {
Thread.sleep(15*1000);
} catch (InterruptedException ie) {
break;
}
} }
_statusBar.update("Status thread died");
System.err.println(MARKER + this + " status thread finished" + System.err.println(MARKER + this + " status thread finished" +
" Current state is: " + _state); " Current state is: " + _state);
} }
......
...@@ -45,7 +45,8 @@ class LogWriter implements Runnable { ...@@ -45,7 +45,8 @@ class LogWriter implements Runnable {
try { try {
while (_write) { while (_write) {
flushRecords(); flushRecords();
rereadConfig(); if (_write)
rereadConfig();
} }
} catch (Exception e) { } catch (Exception e) {
System.err.println("Error writing the logs: " + e.getMessage()); System.err.println("Error writing the logs: " + e.getMessage());
...@@ -103,6 +104,14 @@ class LogWriter implements Runnable { ...@@ -103,6 +104,14 @@ class LogWriter implements Runnable {
log(rec.getPriority(), rec.getSource(), rec.getSourceName(), rec.getThreadName(), rec.getMessage()); log(rec.getPriority(), rec.getSource(), rec.getSourceName(), rec.getThreadName(), rec.getMessage());
else else
log(rec.getPriority(), rec.getSource(), rec.getSourceName(), rec.getThreadName(), rec.getMessage(), rec.getThrowable()); log(rec.getPriority(), rec.getSource(), rec.getSourceName(), rec.getThreadName(), rec.getMessage(), rec.getThrowable());
// we always add to the console buffer, but only sometimes write to stdout
if (_manager.getDisplayOnScreenLevel() <= rec.getPriority()) {
if (_manager.displayOnScreen()) {
// android log already does time stamps, so reformat without the date
System.out.print(LogRecordFormatter.formatRecord(_manager, rec, false));
}
}
} }
public void log(int priority, Class src, String name, String threadName, String msg) { public void log(int priority, Class src, String name, String threadName, String msg) {
......
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