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

Add timeout mechanism

This commit is contained in:
Jesse Li
2019-12-24 13:23:46 -05:00
parent 415666a020
commit f9a22a6d9f
2 changed files with 52 additions and 74 deletions

View File

@@ -6,7 +6,6 @@ import (
"crypto/sha1"
"fmt"
"io"
"net"
"github.com/jackpal/bencode-go"
"github.com/veggiedefender/torrent-client/p2p"
@@ -45,10 +44,8 @@ func (t *Torrent) Download() error {
return err
}
// peers, err := t.getPeers(peerID, Port)
peers := []p2p.Peer{{IP: net.IP{127, 0, 0, 1}, Port: 51413}}
fmt.Println(peers[:1])
downloader := p2p.Downloader{
peers, err := t.getPeers(peerID, Port)
downloader := p2p.Download{
Peers: peers,
PeerID: peerID,
InfoHash: t.InfoHash,