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.
vor 18 Jahren
Richard Nyberg
f939819e28
No parenthesis needed around a string value.
vor 18 Jahren
Richard Nyberg
4f1d44297a
Don't really know why I did setlocale. Get rid of it since I want the CTYPE
to be standard.
vor 18 Jahren
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.
vor 18 Jahren
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.
vor 18 Jahren
Richard Nyberg
110b1d7e22
Always update the tlib info when a torrent is stopped. Some code shuffle.
vor 18 Jahren
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.
vor 18 Jahren
Richard Nyberg
b0b50e29b6
Create all files of a torrent at startup.
vor 18 Jahren
Richard Nyberg
0b9d19de09
Add missing include.
vor 18 Jahren
Richard Nyberg
11f7e1ce1f
Safer way to initialize the address.
vor 18 Jahren
Richard Nyberg
45bf9f2658
Allow empty files in torrents. Create them in stat_and_adjust and let the
stream abstraction skip past them.
vor 18 Jahren
Richard Nyberg
a087071b45
Make the del command work for active torrents too.
vor 18 Jahren
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.
vor 18 Jahren
Richard Nyberg
7ae55cac4d
Save the total amount down- and uploaded and cache the torrent size and the
amount we have in the info file.
vor 18 Jahren
Richard Nyberg
326dc406e7
Remove unneeded braces.
vor 18 Jahren
Richard Nyberg
ba9ae40fe7
Add command to stop all active torrents. The command is sent by
'btcli stop -a'.
vor 18 Jahren
Richard Nyberg
b169d038fe
Return rates in bytes/s instead of time factor * bytes/s. Clients should
not need to know about the sample time.
vor 18 Jahren
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.
vor 18 Jahren
Richard Nyberg
e33b8a57e6
Move the td_* functions to their own file. Remove lots of unneeded includes.
vor 18 Jahren
Richard Nyberg
fd7d7fca08
Implement the "key" tracker extension.
vor 18 Jahren
Richard Nyberg
0c9cc2aa1d
Enable printf format type checking.
vor 18 Jahren
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.
vor 18 Jahren
Richard Nyberg
2c15b5701f
No need to have the net structs on a list. Fix a test for finding a torrent
with active net.
vor 18 Jahren
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.
vor 18 Jahren
Richard Nyberg
fc20273a80
Moved to ../misc/queue.h
vor 18 Jahren
Richard Nyberg
c4379cdfb9
Send keepalives.
vor 18 Jahren
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.
vor 18 Jahren
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.
vor 18 Jahren
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.
vor 18 Jahren
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.
vor 18 Jahren
Richard Nyberg
336a4d4c02
Changed the help for the '--ipcprot' option.
vor 18 Jahren
Richard Nyberg
2e073c13f2
Truncate the pid file when opening it. Now it actually will contain the pid
of the btpd process :)
vor 18 Jahren
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.
vor 18 Jahren
Richard Nyberg
7810b15cfd
Add the '--ipcprot' option to change the protection mode of the command
socket. From Arnaud Bergeron.
vor 18 Jahren
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.
vor 18 Jahren
Richard Nyberg
cfb37a5227
Split out common code for btpd_log and btpd_err.
vor 18 Jahren
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.
vor 18 Jahren
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.
vor 19 Jahren
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!
vor 19 Jahren
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.
vor 19 Jahren
Richard Nyberg
9f4070eeb8
There's now one list with requests per piece instead of one per block. The
network buffers for requests are now allocated as they're needed. Before
they were allocated at the same time as their corresponding piece. This
lowers btpd's memory consumption.
vor 19 Jahren
Richard Nyberg
6214255bbb
Safer code for net_read32 and net_write32. It may have been possible for them
to cause failure on some architectures because of unaligned fetch/write of
integers.
vor 19 Jahren
Richard Nyberg
f219b47a33
Set default value of cm_alloc_size to 2MB.
vor 19 Jahren
Richard Nyberg
1b3c4e7c05
Set its rates to zero when stopping a torrent.
vor 19 Jahren
Richard Nyberg
eb85993c8c
Don't allow a negative cm_alloc_size to wreak havoc.
vor 19 Jahren
Richard Nyberg
2ee5eed062
Return possible error message in the http result. Log the error in the
tracker code.
vor 19 Jahren
Richard Nyberg
61752ade71
Change preallocation default to 2048. 1 may be a little low.
vor 19 Jahren
Richard Nyberg
bcac74d138
Safer type use.
vor 19 Jahren
Richard Nyberg
b61b04f258
Fix typo.
vor 19 Jahren
Richard Nyberg
88aa2eeb63
Better log message.
vor 19 Jahren