Richard Nyberg
352ed70600
Update the build scripts for the following events:
o Some new source files.
o Inclusion of libevent.
o Removal of curl and pthreads dependencies.
19 роки тому
Richard Nyberg
8c5200b568
Instead of immediately reading all data a peer requests into outgoing net
buffers, we put placeholder buffers on the list and fill them as they are
needed. At most 4 blocks will be filled per peer we upload to. This number
should probably be made tunable or be based on SO_SNDBUF or something.
Anyway, this should lower btpd's memory usage if one has many uploads.
19 роки тому
Richard Nyberg
acc03a93e2
Must call next_url if the current url cannot be requested.
19 роки тому
Richard Nyberg
3bb3d2c074
Initialize the interval variable even when we don't read its value from the
tracker reply.
19 роки тому
Richard Nyberg
db7f22db73
Avoid unnecessary operations on tracker stop. Use STOP_ERRORS constant
for the number of tracker errors to tolerate when we're stopping.
19 роки тому
Richard Nyberg
ebef96d5f8
Missed this file in the last commit. Simplify some interfaces by polling
for state changes when appropriate instead of being called directly at any
time.
19 роки тому
Richard Nyberg
95e83bb247
Make the content code unthreaded and remove the no longer needed inter
thread messaging code. Also simplify some interfaces by polling for
state changes when appropriate instead of being called directly at any
time.
19 роки тому
Richard Nyberg
abe4001938
Add initialization of evdns.
19 роки тому
Richard Nyberg
fb64d693f1
Now that btpd doesn't use select, we don't need to limit fd's to FD_SETSIZE
unless libevent uses the select method.
19 роки тому
Richard Nyberg
4466a515e7
Remove calls to the already removed old http code.
19 роки тому
Richard Nyberg
03c3b7ec49
Split the tracker code into a generic part and a http specific part. This
allows me to add code for other types of trackers.
Remove the curl interface glue, since I use my own http client now. The curl
code was my main reason for using threads, so I'm a large step closer to make
btpd unthreaded again.
19 роки тому
Richard Nyberg
f939819e28
No parenthesis needed around a string value.
19 роки тому
Richard Nyberg
4f1d44297a
Don't really know why I did setlocale. Get rid of it since I want the CTYPE
to be standard.
19 роки тому
Richard Nyberg
1a17b22bb3
Don't call mkdirs unnecessarily. Note that this code is only needed because
the content code shuts down btpd on errors. When that is fixed this code can
be removed.
19 роки тому
Richard Nyberg
cd8a3d5ecd
Make mkdirs behave more like 'mkdir -p' and make btpd create the directory
hierarchy to a specified torrent content directory if neccessary.
19 роки тому
Richard Nyberg
110b1d7e22
Always update the tlib info when a torrent is stopped. Some code shuffle.
19 роки тому
Richard Nyberg
25788505fa
Forgot to free some memory. Remove some broken code; it wasn't needed
yet anyway. glibc doesn't have the d_namlen field in struct dirent, so
we'll have to use strlen instead.
19 роки тому
Richard Nyberg
b0b50e29b6
Create all files of a torrent at startup.
19 роки тому
Richard Nyberg
0b9d19de09
Add missing include.
19 роки тому
Richard Nyberg
11f7e1ce1f
Safer way to initialize the address.
19 роки тому
Richard Nyberg
45bf9f2658
Allow empty files in torrents. Create them in stat_and_adjust and let the
stream abstraction skip past them.
19 роки тому
Richard Nyberg
a087071b45
Make the del command work for active torrents too.
19 роки тому
Richard Nyberg
e652eefa26
Add value queries for total amount up- and downloaded. Use the cached values
for torrent size and amount gotten when the torrent isn't active.
19 роки тому
Richard Nyberg
7ae55cac4d
Save the total amount down- and uploaded and cache the torrent size and the
amount we have in the info file.
19 роки тому
Richard Nyberg
326dc406e7
Remove unneeded braces.
19 роки тому
Richard Nyberg
ba9ae40fe7
Add command to stop all active torrents. The command is sent by
'btcli stop -a'.
19 роки тому
Richard Nyberg
b169d038fe
Return rates in bytes/s instead of time factor * bytes/s. Clients should
not need to know about the sample time.
19 роки тому
Richard Nyberg
a5ae3e120f
Some changes to the iobuf interface. Remove a debug assert from btpd_if.c and
make it act properly on iobuf errors.
19 роки тому
Richard Nyberg
e33b8a57e6
Move the td_* functions to their own file. Remove lots of unneeded includes.
19 роки тому
Richard Nyberg
fd7d7fca08
Implement the "key" tracker extension.
19 роки тому
Richard Nyberg
0c9cc2aa1d
Enable printf format type checking.
19 роки тому
Richard Nyberg
1911f326a6
Implement the multitracker extension. Removed checks for URLs that
btpd can handle for now, so if no such URLs exists there will be a
lot of tracker errors reported.
19 роки тому
Richard Nyberg
2c15b5701f
No need to have the net structs on a list. Fix a test for finding a torrent
with active net.
19 роки тому
Richard Nyberg
86754d7d53
btpd now has a library of torrents indexed by number and info hash.
The add and del commands adds or removes torrents from this library.
The start and stop commands are used to active or deactivate torrents.
Also, a mechanism for qeurying data on torrents has been added. It's
only used by the btcli list and stat commands yet though.
btcli has been split into different files for each command.
Both btpd and btcli now use misc/btpd_if.h for all ipc definitions.
Misc changes:
- struct metainfo is gone. Use the new mi_* functions.
- Add printf format type checking where appropriate.
19 роки тому
Richard Nyberg
fc20273a80
Moved to ../misc/queue.h
19 роки тому
Richard Nyberg
c4379cdfb9
Send keepalives.
19 роки тому
Richard Nyberg
1f4ef6cb15
Reduce the number of HAVE messages sent by only sending them to peers missing
the piece. Remove seeder peers when our download is finished and remove peers
who doesn't show any interest for a long time when we're seeding.
19 роки тому
Richard Nyberg
e0877d2870
Torrents that were active when btpd was last killed will now be automatically
started when btpd starts. The new '--empty-start' option turns this off.
19 роки тому
Richard Nyberg
251b5d2e18
Add a delay for contacting the same announce url. This way we don't spam
a tracker with connections even if we add a lot of torrents with the same
tracker at the same time.
19 роки тому
Richard Nyberg
7ce1098dff
Remove the events for a peer's socket before closing it. At least the epoll
libevent backend didn't like the fd to be closed. Reported by Ludvig Omholt.
19 роки тому
Richard Nyberg
336a4d4c02
Changed the help for the '--ipcprot' option.
19 роки тому
Richard Nyberg
2e073c13f2
Truncate the pid file when opening it. Now it actually will contain the pid
of the btpd process :)
19 роки тому
Richard Nyberg
2285473192
Make sure btpd_dir contains an absolute path. If btpd was started with
'-d some/releative/path' it would fail to set up the ipc socket correctly.
Reported by Arnaud Bergeron.
19 роки тому
Richard Nyberg
7810b15cfd
Add the '--ipcprot' option to change the protection mode of the command
socket. From Arnaud Bergeron.
19 роки тому
Richard Nyberg
2a462baead
Btpd could be DOS'ed by incoming connections that never send any data.
Strangely such connections are not entirely uncommon. Added a hand shake
time out of 60 seconds to resolve this.
Added a peer_on_tick function which is used to monitor peers for different
timeouts. Timestamps are compared against the reborn btpd_seconds.
The issue has been reported by Ludvig Omholt and Arnaud Bergeron.
19 роки тому
Richard Nyberg
cfb37a5227
Split out common code for btpd_log and btpd_err.
19 роки тому
Richard Nyberg
ed56df9e56
Use the new functions btpd_ev_(add|del) instead of calling event_(add|del)
directly. Failure to add or delete an event is treated as a fatal error.
19 роки тому
Richard Nyberg
db49763849
The previous commit was a bit over zealous; the block field should not be
cleared for a failed piece in the full torrent test. This also fixes a bug
where the content byte count wasn't decreased for failed pieces.
19 роки тому
Richard Nyberg
b72b6bb8ba
The code for testing content that has potentially been modified between btpd
runs was quite broken. Pieces stayed marked as ok event though the hash test
failed for pieces in modified files. Oops!
19 роки тому
Richard Nyberg
cdb471d0ac
Fix a bug from the last commit: shared messages for endgame requests could
be placed at the wrong index in the array.
19 роки тому