forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p.zzz.test' (head 48448fc896d1e0859f481e98d0e80e764cc40736)
to branch 'i2p.i2p' (head aedb9b8335d6de72dd633e79716fff6ffec263a1)
This commit is contained in:
@@ -518,6 +518,7 @@ public class KBucketSet<T extends SimpleDataStructure> {
|
||||
|
||||
/**
|
||||
* For every bucket that hasn't been updated in this long,
|
||||
* or isn't close to full,
|
||||
* generate a random key that would be a member of that bucket.
|
||||
* The returned keys may be searched for to "refresh" the buckets.
|
||||
* @return non-null, closest first
|
||||
@@ -528,7 +529,7 @@ public class KBucketSet<T extends SimpleDataStructure> {
|
||||
getReadLock();
|
||||
try {
|
||||
for (KBucket b : _buckets) {
|
||||
if (b.getLastChanged() < old)
|
||||
if (b.getLastChanged() < old || b.getKeyCount() < BUCKET_SIZE * 3 / 4)
|
||||
rv.add(generateRandomKey(b));
|
||||
}
|
||||
} finally { releaseReadLock(); }
|
||||
|
@@ -744,7 +744,19 @@ class PeerCoordinator implements PeerListener
|
||||
break;
|
||||
if (havePieces.get(p.getId()) && !p.isRequested())
|
||||
{
|
||||
piece = p;
|
||||
// never ever choose one that's in partialPieces, or we
|
||||
// will create a second one and leak
|
||||
boolean hasPartial = false;
|
||||
for (PartialPiece pp : partialPieces) {
|
||||
if (pp.getPiece() == p.getId()) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("wantPiece() skipping partial for " + peer + ": piece = " + pp);
|
||||
hasPartial = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasPartial)
|
||||
piece = p;
|
||||
}
|
||||
else if (p.isRequested())
|
||||
{
|
||||
@@ -946,13 +958,14 @@ class PeerCoordinator implements PeerListener
|
||||
*/
|
||||
public boolean gotPiece(Peer peer, PartialPiece pp)
|
||||
{
|
||||
if (metainfo == null || storage == null)
|
||||
return true;
|
||||
if (storage.isChecking())
|
||||
if (metainfo == null || storage == null || storage.isChecking()) {
|
||||
pp.release();
|
||||
return true;
|
||||
}
|
||||
int piece = pp.getPiece();
|
||||
if (halted) {
|
||||
_log.info("Got while-halted piece " + piece + "/" + metainfo.getPieces() +" from " + peer + " for " + metainfo.getName());
|
||||
pp.release();
|
||||
return true; // We don't actually care anymore.
|
||||
}
|
||||
|
||||
@@ -967,8 +980,10 @@ class PeerCoordinator implements PeerListener
|
||||
// Assume we got a good piece, we don't really care anymore.
|
||||
// Well, this could be caused by a change in priorities, so
|
||||
// only return true if we already have it, otherwise might as well keep it.
|
||||
if (storage.getBitField().get(piece))
|
||||
if (storage.getBitField().get(piece)) {
|
||||
pp.release();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
@@ -1285,6 +1300,7 @@ class PeerCoordinator implements PeerListener
|
||||
PartialPiece pp = iter.next();
|
||||
if (pp.getPiece() == piece) {
|
||||
iter.remove();
|
||||
pp.release();
|
||||
// there should be only one but keep going to be sure
|
||||
}
|
||||
}
|
||||
|
@@ -592,6 +592,7 @@ class PeerState implements DataLoader
|
||||
// Send cancel even when we are choked to make sure that it is
|
||||
// really never ever send.
|
||||
out.sendCancel(req);
|
||||
req.getPartialPiece().release();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -741,6 +742,10 @@ class PeerState implements DataLoader
|
||||
out.sendRequest(r);
|
||||
lastRequest = r;
|
||||
return true;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Got dup from coord: " + pp);
|
||||
pp.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -572,7 +572,9 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
|
||||
_session.removeListener(I2PSession.PROTO_DATAGRAM_RAW, _rPort);
|
||||
// clear the DHT and tracker
|
||||
_tracker.stop();
|
||||
PersistDHT.saveDHT(_knownNodes, _dhtFile);
|
||||
// don't lose all our peers if we didn't have time to check them
|
||||
boolean saveAll = _context.clock().now() - _started < 20*60*1000;
|
||||
PersistDHT.saveDHT(_knownNodes, saveAll, _dhtFile);
|
||||
_knownNodes.stop();
|
||||
for (Iterator<ReplyWaiter> iter = _sentQueries.values().iterator(); iter.hasNext(); ) {
|
||||
ReplyWaiter waiter = iter.next();
|
||||
|
@@ -56,12 +56,15 @@ abstract class PersistDHT {
|
||||
log.info("Loaded " + count + " nodes from " + file);
|
||||
}
|
||||
|
||||
public static synchronized void saveDHT(DHTNodes nodes, File file) {
|
||||
/**
|
||||
* @param saveAll if true, don't check last seen time
|
||||
*/
|
||||
public static synchronized void saveDHT(DHTNodes nodes, boolean saveAll, File file) {
|
||||
if (nodes.size() <= 0)
|
||||
return;
|
||||
Log log = I2PAppContext.getGlobalContext().logManager().getLog(PersistDHT.class);
|
||||
int count = 0;
|
||||
long maxAge = I2PAppContext.getGlobalContext().clock().now() - MAX_AGE;
|
||||
long maxAge = saveAll ? 0 : I2PAppContext.getGlobalContext().clock().now() - MAX_AGE;
|
||||
PrintWriter out = null;
|
||||
try {
|
||||
out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new SecureFileOutputStream(file), "ISO-8859-1")));
|
||||
|
@@ -12,9 +12,9 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: I2P\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2012-10-12 00:46+0000\n"
|
||||
"PO-Revision-Date: 2012-10-12 00:39+0000\n"
|
||||
"Last-Translator: kytv <killyourtv@i2pmail.org>\n"
|
||||
"POT-Creation-Date: 2012-10-15 17:57+0000\n"
|
||||
"PO-Revision-Date: 2012-10-12 00:54+0000\n"
|
||||
"Last-Translator: BadCluster <badcluster@i2pmail.org>\n"
|
||||
"Language-Team: Italian (http://www.transifex.com/projects/p/I2P/language/"
|
||||
"it/)\n"
|
||||
"Language: it\n"
|
||||
@@ -342,7 +342,7 @@ msgstr "Torrent in aggiunta in {0}"
|
||||
#: ../java/src/org/klomp/snark/SnarkManager.java:1374
|
||||
#, java-format
|
||||
msgid "Up bandwidth limit is {0} KBps"
|
||||
msgstr ""
|
||||
msgstr "La banda di Upload massima è {0} KBps"
|
||||
|
||||
#: ../java/src/org/klomp/snark/SnarkManager.java:1396
|
||||
#, java-format
|
||||
@@ -606,7 +606,7 @@ msgstr "File torrent eliminato: {0}"
|
||||
#: ../java/src/org/klomp/snark/web/I2PSnarkServlet.java:642
|
||||
#, java-format
|
||||
msgid "Download deleted: {0}"
|
||||
msgstr ""
|
||||
msgstr "Downloads cancellati: {0}"
|
||||
|
||||
#: ../java/src/org/klomp/snark/web/I2PSnarkServlet.java:656
|
||||
#, java-format
|
||||
@@ -701,12 +701,12 @@ msgstr "Ripristina tracker di default"
|
||||
#: ../java/src/org/klomp/snark/web/I2PSnarkServlet.java:997
|
||||
#: ../java/src/org/klomp/snark/web/I2PSnarkServlet.java:998
|
||||
msgid "Checking"
|
||||
msgstr ""
|
||||
msgstr "Controllo (Check)"
|
||||
|
||||
#: ../java/src/org/klomp/snark/web/I2PSnarkServlet.java:1000
|
||||
#: ../java/src/org/klomp/snark/web/I2PSnarkServlet.java:1001
|
||||
msgid "Allocating"
|
||||
msgstr ""
|
||||
msgstr "Allocando"
|
||||
|
||||
#: ../java/src/org/klomp/snark/web/I2PSnarkServlet.java:1005
|
||||
#: ../java/src/org/klomp/snark/web/I2PSnarkServlet.java:1011
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user