snark up bw tracking tweak
This commit is contained in:
@ -163,10 +163,22 @@ class PeerConnectionOut implements Runnable
|
|||||||
removeMessage(Message.PIECE);
|
removeMessage(Message.PIECE);
|
||||||
|
|
||||||
// XXX - Should also register overhead...
|
// XXX - Should also register overhead...
|
||||||
if (m.type == Message.PIECE)
|
// Don't let other clients requesting big chunks get an advantage
|
||||||
state.uploaded(m.len);
|
// 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);
|
m.sendMessage(dout);
|
||||||
|
if (remainder > 0)
|
||||||
|
state.uploaded(remainder);
|
||||||
m = null;
|
m = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user