forked from I2P_Developers/i2p.i2p
use ByteCache for chunks in/out
This commit is contained in:
@@ -27,6 +27,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.ByteArray;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
class PeerState implements DataLoader
|
||||
@@ -245,8 +246,8 @@ class PeerState implements DataLoader
|
||||
* @return bytes or null for errors
|
||||
* @since 0.8.2
|
||||
*/
|
||||
public byte[] loadData(int piece, int begin, int length) {
|
||||
byte[] pieceBytes = listener.gotRequest(peer, piece, begin, length);
|
||||
public ByteArray loadData(int piece, int begin, int length) {
|
||||
ByteArray pieceBytes = listener.gotRequest(peer, piece, begin, length);
|
||||
if (pieceBytes == null)
|
||||
{
|
||||
// XXX - Protocol error-> diconnect?
|
||||
@@ -256,7 +257,7 @@ class PeerState implements DataLoader
|
||||
}
|
||||
|
||||
// More sanity checks
|
||||
if (length != pieceBytes.length)
|
||||
if (length != pieceBytes.getData().length)
|
||||
{
|
||||
// XXX - Protocol error-> disconnect?
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
|
||||
Reference in New Issue
Block a user