propagate from branch 'i2p.i2p' (head db152f1a9e08e80c7bd3b87735b51800e8f4c46f)

to branch 'i2p.i2p.zzz.dhtsnark' (head 9b08b2f47961167d0fee52b6481895c494d410d6)
This commit is contained in:
zzz
2012-06-24 19:53:20 +00:00
9 changed files with 39 additions and 17 deletions

View File

@ -125,7 +125,7 @@ class PeerCoordinator implements PeerListener
/** partial pieces - lock by synching on wantedPieces - TODO store Requests, not PartialPieces */ /** partial pieces - lock by synching on wantedPieces - TODO store Requests, not PartialPieces */
private final List<PartialPiece> partialPieces; private final List<PartialPiece> partialPieces;
private boolean halted = false; private volatile boolean halted;
private final MagnetState magnetState; private final MagnetState magnetState;
private final CoordinatorListener listener; private final CoordinatorListener listener;
@ -429,6 +429,14 @@ class PeerCoordinator implements PeerListener
} }
} }
/**
* @since 0.9.1
*/
public void restart() {
halted = false;
timer.schedule((CHECK_PERIOD / 2) + _random.nextInt((int) CHECK_PERIOD));
}
public void connected(Peer peer) public void connected(Peer peer)
{ {
if (halted) if (halted)

View File

@ -553,21 +553,14 @@ public class Snark
} }
stopped = false; stopped = false;
boolean coordinatorChanged = false;
if (coordinator.halted()) { if (coordinator.halted()) {
// ok, we have already started and stopped, but the coordinator seems a bit annoying to coordinator.restart();
// restart safely, so lets build a new one to replace the old
if (_peerCoordinatorSet != null) if (_peerCoordinatorSet != null)
_peerCoordinatorSet.remove(coordinator); _peerCoordinatorSet.add(coordinator);
PeerCoordinator newCoord = new PeerCoordinator(_util, id, infoHash, meta, storage, this, this);
if (_peerCoordinatorSet != null)
_peerCoordinatorSet.add(newCoord);
coordinator = newCoord;
coordinatorChanged = true;
} }
if (!trackerclient.started() && !coordinatorChanged) { if (!trackerclient.started()) {
trackerclient.start(); trackerclient.start();
} else if (trackerclient.halted() || coordinatorChanged) { } else if (trackerclient.halted()) {
if (storage != null) { if (storage != null) {
try { try {
storage.reopen(rootDataDir); storage.reopen(rootDataDir);

View File

@ -511,7 +511,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
if (sm == null) if (sm == null)
return; return;
Properties props = tunnel.getClientOptions(); Properties props = tunnel.getClientOptions();
sm.setDefaultOptions(sockMgr.buildOptions(props)); sm.setDefaultOptions(sm.buildOptions(props));
} }
/** /**

View File

@ -584,7 +584,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
} else { } else {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug(getPrefix() + "Message received of type " + message.getType() _log.debug(getPrefix() + "Message received of type " + message.getType()
+ " to be handled by " + handler); + " to be handled by " + handler.getClass().getSimpleName());
handler.handleMessage(message, this); handler.handleMessage(message, this);
} }
} }

View File

@ -599,7 +599,6 @@ public class ElGamalAESEngine {
//_log.debug("Encrypting AES"); //_log.debug("Encrypting AES");
if (tagsForDelivery == null) tagsForDelivery = Collections.EMPTY_SET; if (tagsForDelivery == null) tagsForDelivery = Collections.EMPTY_SET;
int size = 2 // sizeof(tags) int size = 2 // sizeof(tags)
+ tagsForDelivery.size()
+ SessionTag.BYTE_LENGTH*tagsForDelivery.size() + SessionTag.BYTE_LENGTH*tagsForDelivery.size()
+ 4 // payload length + 4 // payload length
+ Hash.HASH_LENGTH + Hash.HASH_LENGTH

View File

@ -1,3 +1,13 @@
2012-06-24 zzz
* ElGamalAESEngine: Fix bad size estimate when tags are included,
resulting in trailing zeros after the padding
in the unencrypted data
* i2psnark: Don't create a new PeerCoordinator after restart, as the
TrackerClient holds on to the old one and that causes it
to not get peers. Possibly fixes ticket #563.
* I2PTunnel: Fix NPE on shared client creation, thx kytv
* Transport: Add Ethiopia to hidden mode list
2012-06-21 zzz 2012-06-21 zzz
* I2CP: Make separate message ID counters per-destination, use atomic, * I2CP: Make separate message ID counters per-destination, use atomic,
increase max (could have caused "local loopback" problems) increase max (could have caused "local loopback" problems)
@ -5,6 +15,7 @@
streaming messages don't get split up unnecessarily streaming messages don't get split up unnecessarily
* OCMOSJ, ElG, Streaming: log tweaks * OCMOSJ, ElG, Streaming: log tweaks
* TunnelInfo: Change msg counter from long to int * TunnelInfo: Change msg counter from long to int
* TunnelPeerSelectors: Minor refactoring to store context
* TunnelPool: Fix bug where a tunnel was marked as reused when it wasn't * TunnelPool: Fix bug where a tunnel was marked as reused when it wasn't
* TunnelPoolManager: Use one ClientPeerSelector for all pools * TunnelPoolManager: Use one ClientPeerSelector for all pools

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 17; public final static long BUILD = 19;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";

View File

@ -21,6 +21,13 @@ import net.i2p.router.ReplyJob;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.util.Log; import net.i2p.util.Log;
/**
* Send a message directly to another router, i.e. not through a tunnel.
* This is safe to run inline via runJob().
* If the RouterInfo for the Hash is not found locally, it will
* queue a lookup and register itself to be run again when the lookup
* succeeds or times out.
*/
public class SendMessageDirectJob extends JobImpl { public class SendMessageDirectJob extends JobImpl {
private final Log _log; private final Log _log;
private final I2NPMessage _message; private final I2NPMessage _message;
@ -39,9 +46,11 @@ public class SendMessageDirectJob extends JobImpl {
public SendMessageDirectJob(RouterContext ctx, I2NPMessage message, Hash toPeer, int timeoutMs, int priority) { public SendMessageDirectJob(RouterContext ctx, I2NPMessage message, Hash toPeer, int timeoutMs, int priority) {
this(ctx, message, toPeer, null, null, null, null, timeoutMs, priority); this(ctx, message, toPeer, null, null, null, null, timeoutMs, priority);
} }
public SendMessageDirectJob(RouterContext ctx, I2NPMessage message, Hash toPeer, ReplyJob onSuccess, Job onFail, MessageSelector selector, int timeoutMs, int priority) { public SendMessageDirectJob(RouterContext ctx, I2NPMessage message, Hash toPeer, ReplyJob onSuccess, Job onFail, MessageSelector selector, int timeoutMs, int priority) {
this(ctx, message, toPeer, null, onSuccess, onFail, selector, timeoutMs, priority); this(ctx, message, toPeer, null, onSuccess, onFail, selector, timeoutMs, priority);
} }
public SendMessageDirectJob(RouterContext ctx, I2NPMessage message, Hash toPeer, Job onSend, ReplyJob onSuccess, Job onFail, MessageSelector selector, int timeoutMs, int priority) { public SendMessageDirectJob(RouterContext ctx, I2NPMessage message, Hash toPeer, Job onSend, ReplyJob onSuccess, Job onFail, MessageSelector selector, int timeoutMs, int priority) {
super(ctx); super(ctx);
_log = getContext().logManager().getLog(SendMessageDirectJob.class); _log = getContext().logManager().getLog(SendMessageDirectJob.class);
@ -66,6 +75,7 @@ public class SendMessageDirectJob extends JobImpl {
} }
public String getName() { return "Send Message Direct"; } public String getName() { return "Send Message Direct"; }
public void runJob() { public void runJob() {
long now = getContext().clock().now(); long now = getContext().clock().now();

View File

@ -16,7 +16,7 @@ abstract class BadCountries {
// zzz.i2p/topics/969 // zzz.i2p/topics/969
// List created based on the Press Freedom Index. Those countries with a score of higher than 50 are included: // List created based on the Press Freedom Index. Those countries with a score of higher than 50 are included:
// http://en.wikipedia.org/wiki/Press_Freedom_Index // http://en.wikipedia.org/wiki/Press_Freedom_Index
// Except: // Except (quote):
// I don't really think that is usage of I2P is dangerous in countries from CIS // I don't really think that is usage of I2P is dangerous in countries from CIS
// General situation is really bad (like in Russia) but people here doesn't have problems with Ecnryption usage. // General situation is really bad (like in Russia) but people here doesn't have problems with Ecnryption usage.
@ -32,6 +32,7 @@ abstract class BadCountries {
/* Democratic Republic of the Congo */ "CD", /* Democratic Republic of the Congo */ "CD",
/* Equatorial Guinea */ "GQ", /* Equatorial Guinea */ "GQ",
/* Eritrea */ "ER", /* Eritrea */ "ER",
/* Ethiopia */ "ET",
/* Fiji */ "FJ", /* Fiji */ "FJ",
/* Honduras */ "HN", /* Honduras */ "HN",
/* Iran */ "IR", /* Iran */ "IR",