API changes in github.com/anacrolix/libtorgo
This commit is contained in:
parent
0f8b13dc6d
commit
28afa748e7
|
@ -875,7 +875,7 @@ func (me *Client) addTorrent(t *torrent) (err error) {
|
|||
|
||||
// Adds the torrent to the client.
|
||||
func (me *Client) AddTorrent(metaInfo *metainfo.MetaInfo) (err error) {
|
||||
t, err := newTorrent(BytesInfoHash(metaInfo.InfoHash), metaInfo.AnnounceList)
|
||||
t, err := newTorrent(BytesInfoHash(metaInfo.Info.Hash), metaInfo.AnnounceList)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -885,7 +885,7 @@ func (me *Client) AddTorrent(metaInfo *metainfo.MetaInfo) (err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = me.setMetaData(t, metaInfo.Info, metaInfo.InfoBytes)
|
||||
err = me.setMetaData(t, metaInfo.Info.Info, metaInfo.Info.Bytes)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ func TestPieceHashSize(t *testing.T) {
|
|||
func TestTorrentInitialState(t *testing.T) {
|
||||
dir, mi := testutil.GreetingTestTorrent()
|
||||
defer os.RemoveAll(dir)
|
||||
tor, err := newTorrent(BytesInfoHash(mi.InfoHash), nil)
|
||||
tor, err := newTorrent(BytesInfoHash(mi.Info.Hash), nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = tor.setMetadata(mi.Info, dir, mi.InfoBytes)
|
||||
err = tor.setMetadata(mi.Info.Info, dir, mi.Info.Bytes)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -14,6 +14,6 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("%x: %s\n", mi.InfoHash, arg)
|
||||
fmt.Printf("%x: %s\n", mi.Info.Hash, arg)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
ih = torrent.BytesInfoHash(metaInfo.InfoHash)
|
||||
ih = torrent.BytesInfoHash(metaInfo.Info.Hash)
|
||||
}
|
||||
client.PrioritizeDataRegion(ih, 0, 999999999)
|
||||
err := client.AddPeers(ih, func() []torrent.Peer {
|
||||
|
|
|
@ -105,7 +105,7 @@ func TestUnmountWedged(t *testing.T) {
|
|||
log.Fatal(err)
|
||||
}
|
||||
go func() {
|
||||
ioutil.ReadFile(filepath.Join(layout.MountDir, layout.Metainfo.Name))
|
||||
ioutil.ReadFile(filepath.Join(layout.MountDir, layout.Metainfo.Info.Name))
|
||||
}()
|
||||
time.Sleep(time.Second)
|
||||
fs.Destroy()
|
||||
|
@ -139,7 +139,7 @@ func TestDownloadOnDemand(t *testing.T) {
|
|||
defer seeder.Listener.Close()
|
||||
seeder.Start()
|
||||
defer seeder.Stop()
|
||||
err = seeder.AddMagnet(fmt.Sprintf("magnet:?xt=urn:btih:%x", layout.Metainfo.InfoHash))
|
||||
err = seeder.AddMagnet(fmt.Sprintf("magnet:?xt=urn:btih:%x", layout.Metainfo.Info.Hash))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ func TestDownloadOnDemand(t *testing.T) {
|
|||
leecher.Start()
|
||||
defer leecher.Stop()
|
||||
leecher.AddTorrent(layout.Metainfo)
|
||||
leecher.AddPeers(torrent.BytesInfoHash(layout.Metainfo.InfoHash), []torrent.Peer{func() torrent.Peer {
|
||||
leecher.AddPeers(torrent.BytesInfoHash(layout.Metainfo.Info.Hash), []torrent.Peer{func() torrent.Peer {
|
||||
tcpAddr := seeder.Listener.Addr().(*net.TCPAddr)
|
||||
return torrent.Peer{
|
||||
IP: tcpAddr.IP,
|
||||
|
|
Loading…
Reference in New Issue