2007-01-20 zzz

* Improve performance by not reading in the whole
      piece from disk for each request. A huge memory savings
      on 1MB torrents with many peers.
This commit is contained in:
zzz
2007-01-21 01:43:31 +00:00
committed by zzz
parent 8a87df605b
commit e6e6d6f4ee
2 changed files with 4 additions and 4 deletions

View File

@ -184,7 +184,7 @@ class PeerState
return;
}
byte[] pieceBytes = listener.gotRequest(peer, piece);
byte[] pieceBytes = listener.gotRequest(peer, piece, begin, length);
if (pieceBytes == null)
{
// XXX - Protocol error-> diconnect?
@ -194,7 +194,7 @@ class PeerState
}
// More sanity checks
if (begin >= pieceBytes.length || begin + length > pieceBytes.length)
if (length != pieceBytes.length)
{
// XXX - Protocol error-> disconnect?
if (_log.shouldLog(Log.WARN))

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.476 $ $Date: 2007-01-17 20:42:13 $";
public final static String ID = "$Revision: 1.477 $ $Date: 2007-01-20 19:35:09 $";
public final static String VERSION = "0.6.1.26";
public final static long BUILD = 10;
public final static long BUILD = 11;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);