propagate from branch 'i2p.i2p.zzz.test' (head c295ab421dd719cfe0e273268b5b4e48505e4f61)

to branch 'i2p.i2p' (head 995914d8e049d9bb695fd25e4cf5be860cd4e487)
This commit is contained in:
zzz
2010-03-18 15:49:03 +00:00
69 changed files with 1457 additions and 1213 deletions

View File

@@ -163,10 +163,22 @@ class PeerConnectionOut implements Runnable
removeMessage(Message.PIECE);
// XXX - Should also register overhead...
if (m.type == Message.PIECE)
state.uploaded(m.len);
// Don't let other clients requesting big chunks get an advantage
// when we are seeding;
// only count the rest of the upload after sendMessage().
int remainder = 0;
if (m.type == Message.PIECE) {
if (m.len <= PeerState.PARTSIZE) {
state.uploaded(m.len);
} else {
state.uploaded(PeerState.PARTSIZE);
remainder = m.len - PeerState.PARTSIZE;
}
}
m.sendMessage(dout);
if (remainder > 0)
state.uploaded(remainder);
m = null;
}
}