There was a warning at the end of addrinfo_td because it returns a "void *" but had no return statement. The fix was call pthread_exit().
There was a hard-coded 2MB file size limit on the .torrent files. Set the limit to 0 so read_file() will use the actual file size. Closes GH-14
Applied OpenBSD patches from Nicholas Marriott. Closes GH-12
The timeouts for poll and epoll are given in milliseconds, which caused busy looping in the event loop for timeouts with less time remaining.
Log which peer contributed what to a piece. Do not try to download the same piece from the same peers. Don't download at all from peers implicated in 3 bad pieces. When a previously bad piece has been downloaded successfully the bad peer(s) can be found and banned.
struct peer is now peer and meta_peer. meta_peer can be used as a handle that won't be affected if a peer vanishes. The meta_peers are kept in a hash table to enable fast lookup by peer id.
Unfortunately there are some useless IPv6 trackers that will be used instead of their more usefull IPv4 counterparts when IPv6 is enabled. The -4 and -6 options are tweaked once again. If -6 is given only IPv6 will be used. If both are given both will be used and otherwise only IPv4 will be used. The IPvX stuff should probably be set per torrent in the future.
Unfortunately many don't understand the tracker tiers and put unrelated trackers in the same tier. Thus btpd can't assume that a failure from one tracker in a tier is valid for all trackers in that tier.