]> Sergey Matveev's repositories - btrtrc.git/blobdiff - torrent.go
refactor struct identifiers to follow conventional go names
[btrtrc.git] / torrent.go
index 80ec38316ae18517397ba1add81e6c86cf693ea8..849be74ba261c06bae73c5608bb472b9d49317bb 100644 (file)
@@ -670,9 +670,9 @@ func (t *Torrent) haveAllPieces() bool {
        return t.completedPieces.Len() == t.numPieces()
 }
 
-func (me *Torrent) haveAnyPieces() bool {
-       for i := range me.pieces {
-               if me.pieceComplete(i) {
+func (t *Torrent) haveAnyPieces() bool {
+       for i := range t.pieces {
+               if t.pieceComplete(i) {
                        return true
                }
        }
@@ -701,9 +701,8 @@ func chunkIndex(cs chunkSpec, chunkSize pp.Integer) int {
        return int(cs.Begin / chunkSize)
 }
 
-// TODO: This should probably be called wantPiece.
-func (t *Torrent) wantChunk(r request) bool {
-       if !t.wantPiece(int(r.Index)) {
+func (t *Torrent) wantPiece(r request) bool {
+       if !t.wantPieceIndex(int(r.Index)) {
                return false
        }
        if t.pieces[r.Index].pendingChunk(r.chunkSpec, t.chunkSize) {
@@ -714,8 +713,7 @@ func (t *Torrent) wantChunk(r request) bool {
        return false
 }
 
-// TODO: This should be called wantPieceIndex.
-func (t *Torrent) wantPiece(index int) bool {
+func (t *Torrent) wantPieceIndex(index int) bool {
        if !t.haveInfo() {
                return false
        }