Richard Nyberg
762b3560a5
Missing space.
hace 20 años
Richard Nyberg
aa31f523a3
Queue the bitfield for sending after the handshake is completed.
This fixes a bug where peer could miss pieces btpd got while the
peer was in handshake.
Also, btpd now sends multiple have messages instead of a bitfield
when it's better to do so.
hace 20 años
Richard Nyberg
fcc9418b92
At each bandwidth call the remaining bandwidht counter is set to limit / hz.
Since the set hz is (almost) never achieved the denominator is now based
on the average hz the last 5 seconds.
hace 20 años
Richard Nyberg
3ae85c522a
Spelling.
hace 20 años
Richard Nyberg
f671c4f965
Use the old simpler bandwidth limiter, but run it at a configurable rate.
Let the default be 8 hz for now.
Removed a try at time correction. I don't really think it'll matter and
there was a potential bug if the clock went backwards.
Removed net_by_second. Let the peer bandwidth calculation be handled in
cm_by_second.
hace 20 años
Richard Nyberg
f65633c531
Set a 60s timeout on writes. If a write times ut the peer in question will
be killed.
hace 20 años
Richard Nyberg
40ffcd13c2
Kill a peer when write indicates a closed connection.
hace 20 años
Richard Nyberg
ee7abdea2a
The assert is only valid if we haven't transitioned to end game.
hace 20 años
Richard Nyberg
6bcb6d3816
Code shuffle.
hace 20 años
Richard Nyberg
0ce6fa1d0c
* Use torrent_get_piece instead of loop. Check for correctness.
* Don't decrease busy count on a piece when a block arrives in end game.
The busy count should always be zero at that stage.
hace 20 años
Richard Nyberg
c25ede2479
Clear flag for busy blocks when entering end game.
Add test for program correctness.
hace 20 años
Richard Nyberg
3f6e384568
No need to test piece_full in end game mode.
Added test for program correctness.
hace 20 años
Richard Nyberg
2904cdca2d
Add tests for correctness.
hace 20 años
Richard Nyberg
ce0e134bc4
Increase the number of requests to pipe to 10.
hace 20 años
Richard Nyberg
0c794ac33a
The test for if we should call cm_on_undownload or not wasn't
totally correct. Since there's a possibility that we've assigned
requests to peer and then decreased the wanted level, we could've
missed peers with requests but a wanted level of zero.
Now we check if the peer has any requests instead.
hace 20 años
Richard Nyberg
c8a115a0f0
Introduce the -d option.
hace 20 años
Richard Nyberg
5169d5a862
Missed to update peer->nreqs_out at a couple of places.
hace 20 años
Richard Nyberg
78fddd57db
Peers wasn't removed from the list of unattached peers before being
added to the torrent list. This bug crept in because this file was
based on an earlier version of policy.c.
hace 20 años
Richard Nyberg
5d6ad9d7bb
Don't try to assign requests if the peer already has enough requests.
hace 20 años
Richard Nyberg
0502d4bf92
Rework the download algorithm. This isn't tested yet, but it compiles
so it must be bug free :)
hace 20 años
Richard Nyberg
614afd29cd
Use net_read_to_buf in net_generic_read.
hace 20 años
Richard Nyberg
47aa24ceaf
Add net_read_to_buf getting rid of some common code. I should make
net_generic_read use a real io_buffer and this function too.
hace 20 años
Richard Nyberg
ba425dc31a
Make changes in the choke/interest state of a peer visible to the
policy on a lower level.
hace 20 años
Richard Nyberg
474c7b5b3a
* Better interface between the net and peer code.
The net code now calls the peer code when it has read a full message.
This has mostly involved moving code from net.c to peer.c.
* Added torrent_piece_size helper function.
hace 20 años
Richard Nyberg
96d68439bb
Add check so that we don't connect to more peers than we should.
hace 20 años
Richard Nyberg
f8a4999e40
The generic reader didn't have a buffer that was large enough to
save uncomplete messages. I had forgotten about the four bytes of
message length preceding the message. A buffer overflow could occur
because of this. Ouch!
hace 20 años
Richard Nyberg
051b1b4e2a
Accept more data from tracker.
hace 20 años
Richard Nyberg
617691251e
It wasn't safe to modify the list from within the loop. Fixed it.
hace 20 años
Richard Nyberg
4b9aa9c042
Keep peers not attached to a torrent on a list,
making it possible to remove peers in mid hand-
shake when removing a torrent.
hace 20 años
Richard Nyberg
fda00374c7
Remove #if 0'ed code.
hace 20 años
Richard Nyberg
6bba1ff6f8
Remove unused label.
hace 20 años
Richard Nyberg
bdb91bc49b
Sanity checks.
hace 20 años
Richard Nyberg
27ba618c5e
Move increment of btpd.npeers to a more fitting location.
hace 20 años
Richard Nyberg
36ea68a4b2
No need to check for EINTR.
hace 20 años
Richard Nyberg
2cb31f1244
Update btpd.npeers in the right place.
hace 20 años
Richard Nyberg
f9170e868c
Don't multiply the index by 6, it's increased by that amount each loop.
hace 20 años
Richard Nyberg
b529666a82
Use compact mode for tracker requests.
hace 20 años
Richard Nyberg
307b9a50aa
Before, the count of uploaded torrent data was increases by the block size
as soon as the message head was written to the network. Now it's increased
for each byte of torrent data we've written.
hace 20 años
Richard Nyberg
b84c77f1f7
New algorithm for bandwidth limitation.
hace 20 años
Richard Nyberg
c375a92236
Rename TAILQ to BTPDQ to avoid macro redefinition,
which may happen if some other header includes sys/queue.h.
hace 20 años
Richard Nyberg
33e4dfd65f
Separate the child struct from worker specific data.
hace 20 años
Richard Nyberg
f25e5b2856
sprintf -> snprintf
Removed two unnecessary assignments.
hace 20 años
Richard Nyberg
dd0d462afa
Import btpd-0.1.
git-svn-id: file:///home/rnyberg/svngit/btpd/releases/0.1@1 76a1f634-46fa-0310-9943-bd1476092a85
hace 20 años