mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-06-08 04:21:38 +00:00
i2psnark: Bandwidth limiter improvements
This commit is contained in:
@@ -190,6 +190,8 @@ abstract class ExtensionHandler {
|
||||
}
|
||||
if (log.shouldLog(Log.INFO))
|
||||
log.info("Request chunk " + chk + " from " + peer);
|
||||
// ignore the rv, always request
|
||||
peer.shouldRequest(state.chunkSize(chk));
|
||||
sendRequest(peer, chk);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -230,7 +232,6 @@ abstract class ExtensionHandler {
|
||||
sendPiece(peer, piece, pc, totalSize);
|
||||
// Do this here because PeerConnectionOut only reports for PIECE messages
|
||||
peer.uploaded(pc.length);
|
||||
listener.uploaded(peer, pc.length);
|
||||
} else if (type == TYPE_DATA) {
|
||||
// On close reading of BEP 9, this is the total metadata size.
|
||||
// Prior to 0.9.21, we sent the piece size, so we can't count on it.
|
||||
@@ -245,7 +246,6 @@ abstract class ExtensionHandler {
|
||||
return;
|
||||
int len = is.available();
|
||||
peer.downloaded(len);
|
||||
listener.downloaded(peer, len);
|
||||
// this checks the size
|
||||
done = state.saveChunk(piece, bs, bs.length - len, len);
|
||||
if (log.shouldLog(Log.INFO))
|
||||
@@ -264,6 +264,8 @@ abstract class ExtensionHandler {
|
||||
// get the next chunk
|
||||
if (log.shouldLog(Log.INFO))
|
||||
log.info("Request chunk " + chk + " from " + peer);
|
||||
// ignore the rv, always request
|
||||
peer.shouldRequest(state.chunkSize(chk));
|
||||
sendRequest(peer, chk);
|
||||
}
|
||||
} else if (type == TYPE_REJECT) {
|
||||
|
||||
Reference in New Issue
Block a user