anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.58k stars 630 forks source link

Cannot download file from a not completed peer #906

Closed Septrum101 closed 9 months ago

Septrum101 commented 9 months ago

code snippet

package main

import (
    "log"

    "github.com/anacrolix/torrent"
)

func main() {
    cfg := torrent.NewDefaultClientConfig()
    cfg.Debug = true
    cfg.DisablePEX = true
    cfg.DisableTrackers = true
    cfg.NoDHT= true

    c, _ := torrent.NewClient(cfg)
    defer c.Close()
    t, _ := c.AddTorrentFromFile("fake.file.torrent")
    t.AddPeers([]torrent.PeerInfo{{Addr: addr("10.0.0.199:31557")}})
    <-t.GotInfo()
    t.DownloadAll()
    c.WaitAll()
    log.Print("ermahgerd, torrent downloaded")
}

type addr string

func(a addr) String() string{
    return string(a)
}

When I use those code download file pieces from utorrent client. The code cannot work as expected. The ut have the not completed file. When I use another ut client download the pieces of this file. It can work proply.

anacrolix commented 9 months ago

I didn't test with µtorrent, I don't believe that client is recommended anymore. However testing with qBittorrent worked.

F-TD5X commented 9 months ago

I knew this was not a good place, but I still wondering... @thank243 what was github.com/thank243/trafficConsume this for? and why? 图片

Septrum101 commented 9 months ago

I knew this was not a good place, but I still wondering... @thank243 what was github.com/thank243/trafficConsume this for? and why? 图片

Where you got this conn? I just use a private torrent for testing network model.

F-TD5X commented 9 months ago

@thank243 I'm not sure where I got this peer. And this torrent is Archlinux-2024.02.01. Maybe you can checkout this and try to fix the problem?

Moredistant commented 8 months ago

杂种,NMSL,自己玩就算了,还公布出来 https://github.com/anacrolix/torrent/discussions/891#discussioncomment-8763526