Changeset db0b3da4


Ignore:
Timestamp:
Mar 16, 2010 1:32:34 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
9f1a663
Parents:
5d22d41
Message:

snark up bw tracking tweak

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/PeerConnectionOut.java

    r5d22d41 rdb0b3da4  
    164164
    165165                // XXX - Should also register overhead...
    166                 if (m.type == Message.PIECE)
    167                   state.uploaded(m.len);
     166                // Don't let other clients requesting big chunks get an advantage
     167                // when we are seeding;
     168                // only count the rest of the upload after sendMessage().
     169                int remainder = 0;
     170                if (m.type == Message.PIECE) {
     171                  if (m.len <= PeerState.PARTSIZE) {
     172                     state.uploaded(m.len);
     173                  } else {
     174                     state.uploaded(PeerState.PARTSIZE);
     175                     remainder = m.len - PeerState.PARTSIZE;
     176                  }
     177                }
    168178
    169179                m.sendMessage(dout);
     180                if (remainder > 0)
     181                  state.uploaded(remainder);
    170182                m = null;
    171183              }
Note: See TracChangeset for help on using the changeset viewer.