message when we no longer have any pending requests. This fixes a bug
where two uniterest messages were sent to a peer that was no longer
wanted in endgame.
rid of the global btpd struct. Some fields in the struct got a corresponding
global variable whereas some was made static and moved to a module.
The bandwidht algorithm also got tweaked. It now tries to fire the event
at specific times. This was to make the code simpler. It'll probably have
to be tweaked again :P
First step to make btpd run from a directory where it'll keep the log,
socket, configuration, data on the known torrents, etc. Btpd now uses
flock on the pidfile instead of connecting to the socket in order to
be reasonably sure that no other btpd runs in the same directory.
message followed by an interest message. Optimize this but not sending
those messages in that case. This is better becasue we don't risk to
trigger a choke from the receiving peer.
be shared by several peers. At least in end game.
* Link blocks with the peers we are loading them from and vice versa.
* Limit the number of requests / peer in end game too.
* Improve end game by using some sort of round robin for block requests.
writing to a peer. If more requests arrive they will be ignored.
When all pieces have been sent to the peer, in order for it not to
wait on the ignored requests, its state will be reset by a choke
followed by an unchoke message.
Without this limit there was no bound on how much memory btpd would
consume to satisfy a greedy peer.
* Use the new net_bufs where it makes sense.
* Take advantage of the reference count on net_bufs and only allocate
the (un)choke and (un)interest messages once.
Each piece must have at least one byte for their block bit array,
or they will collide causing great confusion in btpd. The calculation
was done wrong so this could happen for small torrents (blocks / piece < 8).
policy_subr.c:
* Add test for correctness.
* Add missing call to cm_on_piece_full in cm_new_piece.