Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:18
    anacrolix commented #675
  • 01:32
    anacrolix closed #332
  • 01:32
    anacrolix commented #332
  • 01:30
    anacrolix commented #332
  • 01:25
    anacrolix opened #676
  • Sep 27 17:01
    DamiaPoquet opened #675
  • Sep 27 04:17
    FIGBERT commented #332
  • Sep 27 04:15
    FIGBERT commented #332
  • Sep 27 04:15
    FIGBERT commented #332
  • Sep 27 02:43

    anacrolix on master

    Inlineable `(*Torrent).BytesMis… (compare)

  • Sep 27 02:43
    anacrolix closed #633
  • Sep 27 02:43
    anacrolix commented #633
  • Sep 27 02:41

    anacrolix on master

    Inlineable `addrIndex` (#673) (compare)

  • Sep 27 02:41
    anacrolix closed #673
  • Sep 27 02:40
    anacrolix commented #332
  • Sep 25 20:30
    FIGBERT commented #332
  • Sep 25 09:40
    anacrolix reopened #666
  • Sep 24 07:00
    varbhat commented #666
  • Sep 24 00:34
    YenForYang synchronize #670
  • Sep 24 00:33
    YenForYang opened #674
Matt Joiner
@anacrolix
@zhujian0805 more than likely, the *Torrent is nil, you probably haven't initialized it correctly. try running the unit tests, and using cmd/torrent to rule out other issues.
Jian Zhu
@zhujian0805
@anacrolix thanks, will try
Jian Zhu
@zhujian0805
It's interesting that my torrent client downloaded all files and exits from shell, right after that my application complains:it fails to open files.
Jian Zhu
@zhujian0805
looks like i didn't call Drop after downloading
Jian Zhu
@zhujian0805
i need to move the downloaded files, then the application can read it even the, not sure why
Loukas Litsos
@lkslts64
Hi there, I was wondering if the library caps the number of simultaneous uploads per torrent.(https://wiki.theory.org/index.php/BitTorrentSpecification#Choking_and_Optimistic_Unchoking). I took a look at the source but didn't find anything relevant.A remote peer is choked if the client has uploaded 100KiB more than he has downloaded from him (connection.uplloadAllowed method) but I think this doesn't guarantee any limit to the number of peers we are simultaneously uploading to. Is it something that I am missing? thanks
Matt Joiner
@anacrolix
@lkslts64 no, there's no limit to the number of peers uploaded to simultaneously
Loukas Litsos
@lkslts64
ok thanks. Anyways, besides this, I recently developed my own bittorrent client in Go, just for learning/fun, so I ended up looking a lot your project to clarify some things. I was amazed by the quality of the code! I am relatively new in programming so this was the first Go project I digged into but again I don't think that others provide such code quality by leveraging all Go's features and idioms. So thanks for this experience!
Matt Joiner
@anacrolix
@lkslts64 I wish I could say it was all good, but a lot of it is inconsistent, and I'd do a lot differently in hindsight.
ctwyw
@ctwyw
Hi there, Is there any example to building dht server or tracker server ?
Matt Joiner
@anacrolix
@ctwyw you're welcome to peruse anacrolix/dht and the tracker-related parts of anacrolix/torrent.
Jian Zhu
@zhujian0805
i intermittently get those errors, not sure why
https://paste.ubuntu.com/p/bHxGzMWczg/
Jian Zhu
@zhujian0805
sometime it can download successfully, sometime not :(
ctwyw
@ctwyw
@anacrolix I`ve success to build server and client. It was success when use the same torrent file . but if my client use the magnet of that torrent , it was failure. how can I download by using magnet ?
I use [ torrent-magnet < 2.torrent ] to create the magnet , is this right ?
Matt Joiner
@anacrolix
@zhujian0805 sorry for the delay. what errors do you refer to? there are none in that log file
@ctwyw would your network have UDP issues? it's likely your DHT is failing to find peers, or not working at all. are you behind a NAT router? does the magnet link that is created contain any trackers? do you want to PM the link or share it here?
Yaroslav Kolomiiets
@yarikk
@anacrolix krpc.CompactIPv4NodeAddrs (or NodeAddr) does not have the essential To4() piece in its marshaller functions, unlike pp.CompactIp which does. Hence the need to do the dance at the use sites – in particular, the PEX implementation.
Yaroslav Kolomiiets
@yarikk
Yaroslav Kolomiiets
@yarikk
@anacrolix why do we need tt.DownloadAll()? In essence, it calls updatePiecePriority() for every piece. We could do it from onSetInfo() along with updatePieceCompletion() – what do you think?
Loukas Litsos
@lkslts64
@anacrolix Hi again, I can see that in the torrent package you don't make heavy usage of channels. Instead you prefer the sync package. That choice was made for performance reasons or you think that channels don't fit well in this particular application? What made you choose the sync package as the primary synchronization mechanism? Moreover, what would you do differently if you had to make this package again? Thanks in advance and sorry for this type of questions but I would like to hear your thoughts.
Matt Joiner
@anacrolix
@yarikk It's a convenience method from back when the client was first written. anacrolix/torrent does not download on start-up, that's intentional. You must raise the piece or file priorities yourself, or use a torrent.Reader to prompt the client to start downloading.
@lkslts64 Like a lot of people I was sucked in to Go partly due to channels. Channels only work in some simplified situations, they don't handle prioritization of events, they don't combine well with other forms of synchronization, and they don't perform as well (such as requiring huge numbers of goroutines in some situations). I don't think I would switch to channels if I were to do it again, in fact I'd probably use another language like Rust instead. FWIW, teh project was in Python in 2012, and quickly moved to Go.
Loukas Litsos
@lkslts64
@anacrolix Thats right I agree with you. I asked you because in my own BT client, I started up using channels and then realized that the complexity of the code was huge. I was so frustrated by the annoying deadlocks that were happening merely because of the need of bidirectional communication between the channels (N connection goroutines communicating bidirectionally with 1 torrent goroutine). Moreover, channels don't fit well when a connection wants to decide which pieces to download so I ended up using the sync package too and it was much more simplified that way. On the other hand, my implementation avoids having a global lock which improves scalability and also channels cooperate well with the timers and tickers in the time package. But, in conclusion if I were to do it again, I woudn't choose them for sure, the sync package is way more flexible. Another man that fell into the channel overuse trap...
Akshay Ashok
@Akshay090
How can we use a web UI to interact with this library, i saw confluence ( interact with Http) so was wondering if there is some website ui to interact with this ?
Matt Joiner
@anacrolix
@Akshay090 there are, they're separate and/or private projects, see https://github.com/anacrolix/torrent#downstream-projects
ctwyw
@ctwyw
@anacrolix Hi again, I can already download the magnet. these is another question. I build serval server on the PublicIP4 and then build two client behind the NAT router . but could not see them in the DHT node. UNPN is start already. the clients can not share with each other.but the server work well yet. What can I do in this case ?
Listening on 0.0.0.0:63333
Nodes in table: 5 good, 5 total
Ongoing transactions: 0
Server node ID: e0cb86882625a25b8a83002f21cd1f5c46*****

b# node id                                  addr                 anntok last query last response cf
0  2572c85bdb9e52254e629285f7eb329075e***** *.*.*.*:40001  20     never      46s ago       0
0  1a6e0b237b73a79091efd6ca8572c06c9fa***** *.*.*.*:40002  20     never      45s ago       0
1  ae614ab3fc2288a8607fb5264e1cef6d7b4***** *.*.*.*:40002   20     never      45s ago       0
1  9d415d2479966acd83c3b3446cbb97a209f***** *.*.*.*:40002 20     never      45s ago       0
1  9730ca99ccae7eb8d243846063fe951326f***** *.*.*.*:40002    20     never      45s ago       0
ctwyw
@ctwyw
I saw this in the torrent status
error announcing: reading from socket: read udp4 192.168.199.229:64718->*:40002: i/o timeout
Yaroslav Kolomiiets
@yarikk
@anacrolix , I just noticed anacrolix/torrent@c1d189e, how much of a performance gain did the change allows to get? I'm also exploring ways to speed it up
Matt Joiner
@anacrolix
replied in github
imadr
@imadr
Hello, is there a way to specify what directory each torrent is downloaded to, instead of putting them all in ClientConfig.DataDir?
Matt Joiner
@anacrolix
Yes, provide a custom storage at the Client level, or to each Torrent when you add it.
Yaroslav Kolomiiets
@yarikk

@imadr, indeed, like this:

    spec := torrent.TorrentSpecFromMetaInfo(meta)
    compl := storage.NewMapPieceCompletion()
    spec.Storage = storage.NewMMapWithCompletion(dstDir, compl)
    tt, _, err := client.AddTorrentSpec(spec)

(there are options of storage and completion backends to choose from)

imadr
@imadr
thanks!
imadr
@imadr
I'm not able to delete the torrent files even after it finishes, the error from os.RemoveAll is "Access is denied."
Here is an example https://pastebin.com/raw/gKLkq8bk
Also this only happens on windows
Matt Joiner
@anacrolix
@imadr you are not closing the mmap storage before trying to remove the files. On Windows you cannot remove files that are being held open.
imadr
@imadr
It's working, thx
imadr
@imadr
Oops nevermind I talked too soon, it's still saying access denied. I also closed the PieceCompletion for good measure but same, am I doing it wrong?
c := torrentStorage.NewMapPieceCompletion()
mmap := torrentStorage.NewMMapWithCompletion(torrentPath, c)
s.Storage = mmap
...
c.Close()
mmap.Close()
t.Drop()
Matt Joiner
@anacrolix
You should release resources in the reverse order that you allocate them. I'll need more info to help further, can you check for errors returned from those clean-up functions? Could you add a time.Sleep after the clean-up before trying to remove the files in case there's a timing bug? Also run with the race detector enabled.
imadr
@imadr
Here is what I tried https://pastebin.com/raw/EYebt4vr same access denied error and no errors when closing the resources
I also tried with go run -race main.go but nothing changed
Matt Joiner
@anacrolix
@imadr I did some thorough static analysis on MacOS. No files remained memory mapped in the directory you're deleting. I was using github.com/anacrolix/torrent v1.19.2 with your code.
gitpubber
@gitpubber
Matt joiner , I have client with DataDir set to a path
But,i have this case where i need to download torrent to different path
how can i do?
I know of storage.ClientImpl but i am not proficient to do it
gitpubber
@gitpubber
hey,thank you very much
gitpubber
@gitpubber
@anacrolix If i enable webseed in config,is it enough?