<commit_before>package torrent

import (
	"math"

	"github.com/cenkalti/rain/torrent/internal/tracker"
)

func (t *Torrent) announcerFields() tracker.Transfer {
	tr := tracker.Transfer{
		InfoHash: t.infoHash,
		PeerID:   t.peerID,
		Port:     t.port,
	}
	if t.bitfield == nil {
		tr.BytesLeft = math.MaxUint32
	} else {
		// TODO this is wrong, pre-calculate complete and incomplete bytes
		tr.BytesLeft = t.info.TotalLength - int64(t.info.PieceLength)*int64(t.bitfield.Count())
	}
	return tr
}<commit_msg>send correct bytesleft to tracker<commit_after>package torrent

import (
	"math"

	"github.com/cenkalti/rain/torrent/internal/tracker"
)

func (t *Torrent) announcerFields() tracker.Transfer {
	tr := tracker.Transfer{
		InfoHash: t.infoHash,
		PeerID:   t.peerID,
		Port:     t.port,
		// TODO send BytesDownloaded to tracker
		// TODO send BytesUploaded to tracker
	}
	if t.bitfield == nil {
		tr.BytesLeft = math.MaxUint32
	} else {
		tr.BytesLeft = t.info.TotalLength - t.bytesComplete()
	}
	return tr
}
{'fraction_non_alphanumeric': 0.12438302073050346, 'fraction_numerical': 0.007897334649555774, 'mean_word_length': 3.6301369863013697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3176309', 'n_tokens_mistral': 403, 'n_tokens_neox': 370, 'n_words': 81}