1
0
mirror of https://github.com/veggiedefender/torrent-client.git synced 2025-11-06 09:29:16 +02:00

Remove PieceLength from Downloader struct

This commit is contained in:
Jesse
2019-12-22 22:37:27 -05:00
parent 0b46e8444c
commit 12fac89ce5
2 changed files with 6 additions and 8 deletions

View File

@@ -13,10 +13,9 @@ type Peer struct {
// Downloader holds data required to download a torrent from a list of peers
type Downloader struct {
Peers []Peer
InfoHash [20]byte
PieceLength int
Length int
Peers []Peer
InfoHash [20]byte
Length int
}
// Download downloads a torrent

View File

@@ -49,10 +49,9 @@ func (t *Torrent) Download() error {
// fmt.Println(peers)
peers := []p2p.Peer{{IP: net.IP{127, 0, 0, 1}, Port: 51413}}
downloader := p2p.Downloader{
Peers: peers,
InfoHash: t.InfoHash,
PieceLength: t.PieceLength,
Length: t.Length,
Peers: peers,
InfoHash: t.InfoHash,
Length: t.Length,
}
err = downloader.Download()
return err