superafroman / node-torrent

Bittorrent client for node.js.
428 stars 100 forks source link

Load balanced UDP trackers #21

Closed Floby closed 10 years ago

Floby commented 10 years ago

Hello, I've been playing around with the Tracker class alone for the UDP protocol. i've been trying to find peers off of udp://tracker.openbittorrent.com:80/announce. The problem is, that hostname seems to map to several ipv4 DNS records, probably for load balancing purposes. However, when sending its UDP packets, node-torrent uses the hostname everytime which causes the DNS lookup to sometime resolve to another address. In the end, this results in "connection ID missmatch" error messages from the tracker.

A fix for this could be to dns.lookup() the tracker's address once and for all at the begnning.

superafroman commented 10 years ago

Thanks for the info and pull request!