Skip to content

Commit

Permalink
Merge branch 'master' of i2pgit.org:i2p-hackers/i2p.i2p into i2p.i2p.…
Browse files Browse the repository at this point in the history
…2.6.0-sybil-IP-penalty-limits-master
  • Loading branch information
eyedeekay committed Jun 17, 2024
2 parents 3711035 + d4f580e commit b600116
Show file tree
Hide file tree
Showing 158 changed files with 6,509 additions and 9,410 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ jobs:
echo "noExe=true" >> override.properties
- name: test Debian build with Ant
run: ant distclean
- name: build mavenCentral deps with Ant
run: ant mavenCentral.deps
- name: build javadoc with Ant
run: ant distclean javadoc updater
- name: zip javadoc
Expand Down Expand Up @@ -95,8 +93,6 @@ jobs:
echo "build.built-by=GitHub Actions" >> override.properties
echo "noExe=true" >> override.properties
echo "javac.compilerargs=-bootclasspath $HOME/openjdk-7/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar:$HOME/openjdk-7/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jar -Xlint:all" >> override.properties
- name: build mavenCentral deps with Ant
run: ant mavenCentral.deps
- name: build Maven dev build with Ant
run: ./installer/resources/maven-dev-release.sh 1
- name: Upload servlet-i2p.jar
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ Applications:
See licenses/LICENSE-Apache2.0.txt
See licenses/LICENSE-ECLIPSE-1.0.html

RRD4J 3.9 (jrobin.jar):
RRD4J 3.9.1 (jrobin.jar):
Copyright (c) 2001-2005 Sasa Markovic and Ciaran Treanor.
Copyright (c) 2011 The OpenNMS Group, Inc.
Copyright 2011 The RRD4J Authors.
Expand Down
68 changes: 39 additions & 29 deletions apps/desktopgui/locale/messages_in.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,92 +4,102 @@
# To contribute translations, see http://www.i2p2.de/newdevelopers
#
# Translators:
# Adrian Achyar, 2024
# Khairul Agasta <[email protected]>, 2014
# Robert Dafis <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: I2P\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-05-25 12:29+0000\n"
"PO-Revision-Date: 2017-07-27 00:14+0000\n"
"Last-Translator: Robert Dafis <[email protected]>\n"
"Language-Team: Indonesian (http://www.transifex.com/otf/I2P/language/id/)\n"
"POT-Creation-Date: 2023-03-06 14:52+0000\n"
"PO-Revision-Date: 2011-02-13 12:05+0000\n"
"Last-Translator: Adrian Achyar, 2024\n"
"Language-Team: Indonesian (http://app.transifex.com/otf/I2P/language/id/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: id\n"
"Plural-Forms: nplurals=1; plural=0;\n"

#: src/net/i2p/desktopgui/ExternalTrayManager.java:31
#: src/net/i2p/desktopgui/ExternalTrayManager.java:59
msgid "Start I2P"
msgstr "Mulai I2P"

#: src/net/i2p/desktopgui/ExternalTrayManager.java:44
#: src/net/i2p/desktopgui/ExternalTrayManager.java:72
#: src/net/i2p/desktopgui/InternalTrayManager.java:55
msgid "I2P is starting!"
msgstr "I2P sudah memulai!"

#: src/net/i2p/desktopgui/ExternalTrayManager.java:44
#: src/net/i2p/desktopgui/ExternalTrayManager.java:72
#: src/net/i2p/desktopgui/InternalTrayManager.java:55
msgid "Starting"
msgstr "Memulai"

#: src/net/i2p/desktopgui/InternalTrayManager.java:55
#: src/net/i2p/desktopgui/InternalTrayManager.java:207
#: src/net/i2p/desktopgui/InternalTrayManager.java:65
#: src/net/i2p/desktopgui/InternalTrayManager.java:221
msgid "Launch I2P Browser"
msgstr "Luncurkan Peramban I2P"

#: src/net/i2p/desktopgui/InternalTrayManager.java:76
#: src/net/i2p/desktopgui/InternalTrayManager.java:228
#: src/net/i2p/desktopgui/InternalTrayManager.java:86
#: src/net/i2p/desktopgui/InternalTrayManager.java:242
msgid "Configure I2P System Tray"
msgstr "Ubah pengaturan I2P System Tray"

#: src/net/i2p/desktopgui/InternalTrayManager.java:77
#: src/net/i2p/desktopgui/InternalTrayManager.java:229
msgid "Disable"
msgstr "Matikan"
#: src/net/i2p/desktopgui/InternalTrayManager.java:88
#: src/net/i2p/desktopgui/InternalTrayManager.java:244
msgid "Disable system tray"
msgstr "Nonaktifkan system tray"

#: src/net/i2p/desktopgui/InternalTrayManager.java:93
#: src/net/i2p/desktopgui/InternalTrayManager.java:245
#: src/net/i2p/desktopgui/InternalTrayManager.java:104
#: src/net/i2p/desktopgui/InternalTrayManager.java:260
msgid "Restart I2P"
msgstr "Mulai ulang I2P"

#: src/net/i2p/desktopgui/InternalTrayManager.java:110
#: src/net/i2p/desktopgui/InternalTrayManager.java:262
#: src/net/i2p/desktopgui/InternalTrayManager.java:121
#: src/net/i2p/desktopgui/InternalTrayManager.java:277
msgid "Stop I2P"
msgstr "Hentikan I2P"

#: src/net/i2p/desktopgui/InternalTrayManager.java:126
#: src/net/i2p/desktopgui/InternalTrayManager.java:278
#: src/net/i2p/desktopgui/InternalTrayManager.java:137
#: src/net/i2p/desktopgui/InternalTrayManager.java:293
msgid "Restart I2P Immediately"
msgstr "Ulang kembali I2P sekarang"

#: src/net/i2p/desktopgui/InternalTrayManager.java:143
#: src/net/i2p/desktopgui/InternalTrayManager.java:295
#: src/net/i2p/desktopgui/InternalTrayManager.java:154
#: src/net/i2p/desktopgui/InternalTrayManager.java:310
msgid "Stop I2P Immediately"
msgstr "Hentikan I2P sekarang"

#: src/net/i2p/desktopgui/InternalTrayManager.java:157
#: src/net/i2p/desktopgui/InternalTrayManager.java:309
#: src/net/i2p/desktopgui/InternalTrayManager.java:168
#: src/net/i2p/desktopgui/InternalTrayManager.java:324
msgid "Cancel I2P Shutdown"
msgstr "Batal tutup I2P"

#: src/net/i2p/desktopgui/InternalTrayManager.java:363
#: src/net/i2p/desktopgui/InternalTrayManager.java:381
#, java-format
msgid "Shutdown in {0}"
msgstr "Mematikan I2P dalam {0}"

#: src/net/i2p/desktopgui/InternalTrayManager.java:365
#: src/net/i2p/desktopgui/InternalTrayManager.java:383
msgid "Shutdown imminent"
msgstr "I2P sedang dalam proses dimatikan"

#. status translations are in the console bundle
#: src/net/i2p/desktopgui/InternalTrayManager.java:370
#: src/net/i2p/desktopgui/InternalTrayManager.java:388
msgid "Network"
msgstr "Jaringan"

#. Windows typically has tooltips; Linux (at least Ubuntu) doesn't
#: src/net/i2p/desktopgui/TrayManager.java:63
#: src/net/i2p/desktopgui/TrayManager.java:75
msgid "I2P: Right-click for menu"
msgstr "I2P: klik kanan untuk menampilkan menu"

#: src/net/i2p/desktopgui/TrayManager.java:310
#: src/net/i2p/desktopgui/TrayManager.java:347
msgid "Enable notifications"
msgstr "Aktifkan notifikasi"

#: src/net/i2p/desktopgui/TrayManager.java:325
#: src/net/i2p/desktopgui/TrayManager.java:362
msgid "Disable notifications"
msgstr "Nonaktifkan notifikasi"
2 changes: 1 addition & 1 deletion apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ public static void main(String[] args) {
String announce = null;
List<String> url_list = null;
String comment = null;
Getopt g = new Getopt("Storage", args, "a:c:m:w:");
Getopt g = new Getopt("MetaInfo", args, "a:c:m:w:");
try {
int c;
while ((c = g.getopt()) != -1) {
Expand Down
41 changes: 34 additions & 7 deletions apps/i2psnark/java/src/org/klomp/snark/PartialPiece.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,40 @@ public int getLength() {
* @since 0.9.62
*/
public synchronized boolean isComplete() {
return bitfield.complete();
return bitfield.complete();
}

/**
* How many consecutive bytes are good - as set by read().
* There may be more good bytes after "holes".
* Have any chunks been downloaded?
*
* @since 0.9.63
*/
public synchronized boolean hasData() {
return bitfield.count() > 0;
}

/**
* Has this chunk been downloaded?
*
* @since 0.9.63
*/
public synchronized boolean hasChunk(int chunk) {
return bitfield.get(chunk);
}

/**
* How many bytes are good - as set by read().
* As of 0.9.63, accurately counts good bytes after "holes".
*/
public synchronized int getDownloaded() {
return this.off;
if (bitfield.complete())
return pclen;
int sz = bitfield.count();
int rv = sz * PeerState.PARTSIZE;
int rem = pclen % PeerState.PARTSIZE;
if (rem != 0 && bitfield.get(sz - 1))
rv -= PeerState.PARTSIZE - rem;
return rv;
}

/**
Expand Down Expand Up @@ -348,8 +373,10 @@ public void write(DataOutput out, int offset, int len) throws IOException {
public void release() {
if (bs == null) {
synchronized (this) {
if (raf != null)
if (raf != null) {
locked_release();
raf = null;
}
}
//if (raf != null)
// I2PAppContext.getGlobalContext().logManager().getLog(PartialPiece.class).warn("Released " + tempfile);
Expand Down Expand Up @@ -378,7 +405,7 @@ public int compareTo(PartialPiece opp) {
int d = this.piece.compareTo(opp.piece);
if (d != 0)
return d;
return opp.off - this.off; // reverse
return opp.getDownloaded() - getDownloaded(); // reverse
}

@Override
Expand All @@ -401,7 +428,7 @@ public boolean equals(Object o) {

@Override
public String toString() {
return "Partial(" + piece.getId() + ',' + off + ',' + pclen + ')';
return "Partial(" + piece.getId() + ',' + off + ',' + getDownloaded() + ',' + pclen + ')';
}

/**
Expand Down
27 changes: 27 additions & 0 deletions apps/i2psnark/java/src/org/klomp/snark/Peer.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public class Peer implements Comparable<Peer>, BandwidthListener
private final boolean _isIncoming;
private int _totalCommentsSent;
private int _maxPipeline = PeerState.MIN_PIPELINE;
private long connected;
private long pexLastSent;

/**
* Outgoing connection.
Expand Down Expand Up @@ -307,6 +309,7 @@ public void runConnection(I2PSnarkUtil util, PeerListener listener, BandwidthLis
// We are up and running!
state = s;
magnetState = mState;
connected = util.getContext().clock().now();
listener.connected(this);

if (_log.shouldLog(Log.DEBUG))
Expand Down Expand Up @@ -888,4 +891,28 @@ void setTotalCommentsSent(int count) {
public boolean isWebPeer() {
return false;
}

/**
* when did handshake complete?
* @since 0.9.63
*/
public long getWhenConnected() {
return connected;
}

/**
* when did we last send pex peers?
* @since 0.9.63
*/
public long getPexLastSent() {
return pexLastSent;
}

/**
* when did we last send pex peers?
* @since 0.9.63
*/
public void setPexLastSent(long now) {
pexLastSent = now;
}
}
41 changes: 28 additions & 13 deletions apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java
Original file line number Diff line number Diff line change
Expand Up @@ -1370,14 +1370,14 @@ public void savePartialPieces(Peer peer, List<Request> partials)
synchronized(wantedPieces) {
for (Request req : partials) {
PartialPiece pp = req.getPartialPiece();
if (req.off > 0) {
if (pp.hasData()) {
// PartialPiece.equals() only compares piece number, which is what we want
int idx = partialPieces.indexOf(pp);
if (idx < 0) {
partialPieces.add(pp);
if (_log.shouldLog(Log.INFO))
_log.info("Saving orphaned partial piece (new) " + pp);
} else if (idx >= 0 && pp.getDownloaded() > partialPieces.get(idx).getDownloaded()) {
} else if (pp.getDownloaded() > partialPieces.get(idx).getDownloaded()) {
// replace what's there now
partialPieces.get(idx).release();
partialPieces.set(idx, pp);
Expand Down Expand Up @@ -1434,7 +1434,9 @@ public PartialPiece getPartialPiece(Peer peer, BitField havePieces) {
for(Piece piece : wantedPieces) {
if (piece.getId() == savedPiece) {
if (peer.isCompleted() && piece.getPeerCount() > 1 &&
wantedPieces.size() > 2*END_GAME_THRESHOLD) {
wantedPieces.size() > 2*END_GAME_THRESHOLD &&
partialPieces.size() < 4 &&
_random.nextInt(4) != 0) {
// Try to preserve rarest-first
// by not requesting a partial piece that at least two non-seeders also have
// from a seeder
Expand Down Expand Up @@ -1462,7 +1464,7 @@ public PartialPiece getPartialPiece(Peer peer, BitField havePieces) {
iter.remove();
piece.setRequested(peer, true);
if (_log.shouldLog(Log.INFO)) {
_log.info("Restoring orphaned partial piece " + pp +
_log.info("Restoring orphaned partial piece " + pp + " to " + peer +
" Partial list size now: " + partialPieces.size());
}
return pp;
Expand Down Expand Up @@ -1574,7 +1576,9 @@ public void gotExtension(Peer peer, int id, byte[] bs) {
}
}
} else if (id == ExtensionHandler.ID_HANDSHAKE) {
sendPeers(peer);
// We may not have the bitfield yet, but if we do, don't send PEX to seeds
if (!peer.isCompleted())
sendPeers(peer);
sendDHT(peer);
if (_util.utCommentsEnabled())
sendCommentReq(peer);
Expand All @@ -1583,8 +1587,8 @@ public void gotExtension(Peer peer, int id, byte[] bs) {

/**
* Send a PEX message to the peer, if he supports PEX.
* This just sends everybody we are connected to, we don't
* track new vs. old peers yet.
* This sends everybody we have connected to since the
* last time we sent PEX to him.
* @since 0.8.4
*/
void sendPeers(Peer peer) {
Expand All @@ -1598,14 +1602,25 @@ void sendPeers(Peer peer) {
return;
try {
if (bev.getMap().get(ExtensionHandler.TYPE_PEX) != null) {
List<Peer> pList = peerList();
pList.remove(peer);
for (Iterator<Peer> iter = pList.iterator(); iter.hasNext(); ) {
if (iter.next().isWebPeer())
iter.remove();
List<Peer> pList = new ArrayList<Peer>();
long t = peer.getPexLastSent();
for (Peer p : peers) {
if (p.equals(peer))
continue;
if (p.isWebPeer())
continue;
if (p.getWhenConnected() > t)
pList.add(p);
}
if (!pList.isEmpty())
if (!pList.isEmpty()) {
ExtensionHandler.sendPEX(peer, pList);
peer.setPexLastSent(_util.getContext().clock().now());
//if (_log.shouldDebug())
// _log.debug("Pex: sent " + pList.size() + " new peers to " + peer);
//} else {
//if (_log.shouldDebug())
// _log.debug("Pex: no new peers to send to " + peer);
}
}
} catch (InvalidBEncodingException ibee) {}
}
Expand Down
Loading

0 comments on commit b600116

Please sign in to comment.