You've already forked torrent-client
mirror of
https://github.com/veggiedefender/torrent-client.git
synced 2025-11-06 09:29:16 +02:00
Close connection after handling error
Fixes segfault when connection refused
This commit is contained in:
@@ -29,10 +29,10 @@ type Downloader struct {
|
||||
// Download downloads a torrent
|
||||
func (d *Downloader) Download() error {
|
||||
conn, err := d.Peers[0].connect(d.PeerID, d.InfoHash)
|
||||
defer conn.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer conn.Close()
|
||||
h, err := d.handshake(conn)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user