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
Richard Nyberg
c577f4dbff
Better log message.
vor 19 Jahren
Richard Nyberg
cd1164ef02
Be careful not to stop the sub struct if they haven't been started. Also
be careful so that we don't operate on a dead torrent.
vor 19 Jahren
Richard Nyberg
9decd35436
Oops! Forgot to free some memory.
vor 19 Jahren
Richard Nyberg
c865aa9254
Use c99 types conservatively to compile on OpenBSD. Also convert to or from
time_t via long.
vor 19 Jahren
Richard Nyberg
9732ed1981
Glibc needs sys/file.h for flock.
vor 19 Jahren
Richard Nyberg
b43809ba55
Mostly name changes. Add a missing include. Changed the torrent status
characters displayed by btcli.
vor 19 Jahren
Richard Nyberg
bf75d6af1c
Glibc doesn't support locking in open. Use flock after open instead.
vor 19 Jahren
Richard Nyberg
7dedb28137
Put the ACX_PTHREAD macro from the Autoconf macro archive in acinclude.m4.
Build btpd with pthreads.
vor 19 Jahren
Richard Nyberg
59c62b3eb0
Change the downloaders option to max-uploads. I find it much less confusing
that way :P
vor 19 Jahren
Richard Nyberg
31f0e727df
Add torrent_name function and use it.
vor 19 Jahren
Richard Nyberg
19b4bf192b
o Since the torrent sub structs always exist now, we can always write all
stats for torrentst.
o btpd may be waiting for a torrent to finish so it can exit. Therefore
btpd needs to send the reply to the cli before removing the torrent.
vor 19 Jahren
Richard Nyberg
d08a4c991d
There's no need for exactly 64 bits for the upload and download count.
Make them long long instead.
vor 19 Jahren
Richard Nyberg
e3dc78703a
Removed the http_redo hack.
vor 19 Jahren
Richard Nyberg
926838a009
o Make the torrent sub struct exist for whole life time of the torrent.
o Better code for stopping the tracker. No more need for the http_redo hack.
vor 19 Jahren
Richard Nyberg
2550d6cb8c
Interaction with btpd is now much more like I want it. Previous work
has moved toward btpd having a library of torrent to wich one may add
or remove torrents, and where interaction on torrents are done by their
assigned number. This commit is a step back from that and it makes life
simpler and better for all :)
* Some options to btpd has changed:
--no-daemon is the old -d.
-d is now used to specify the btpd directory.
--logfile option is reintroduced.
* The ipc code has been improved on both btpd and cli sides.
* All commands have been implemented.
* Various improvements in btpd.
With this commit we're very close to 0.8 :)
vor 19 Jahren
Richard Nyberg
1a82f0c154
White space.
vor 19 Jahren
Richard Nyberg
01c92051d5
o Changed the benc_ api to make it easier to use.
o Lot of work on the cli and its communication with btpd.
vor 19 Jahren
Richard Nyberg
65f3eb2185
Add a function to look up a torrent by its number.
vor 19 Jahren
Richard Nyberg
53c3ba32cf
Each torrent now gets a number. This number is used to select which torrent
to operate on from btcli.
vor 19 Jahren
Richard Nyberg
886fb651d8
Add function to get tracker error count. Don't look for peers and stuff
in tracker replies when we're stopping.
vor 19 Jahren
Richard Nyberg
2528d4ad73
Help text changes.
vor 19 Jahren
Richard Nyberg
c8f9335e6e
Torrents can now be deactivated and btpd will wait for all torrents to
deactivate on shutdown. To not risk hanging indefinitely on unresponsive
trackers, btpd will cancel tracker requests after a while.
vor 19 Jahren
Richard Nyberg
44165a86d0
o Fixed: cm->active was not set to 0 in cm_stop.
o Since we only use the mtime and size field of the stat struct for resume
info, we now use a struct with only those two fields. This reduces stack
usage.
vor 19 Jahren
Richard Nyberg
76fb776aea
Peers we download from are given a weight of two compared to peers we seed to
when we decide which peers to upload to. Also fix so that we don't prefer to
upload to peers who has had a good rate but isn't uploading to us now.
vor 19 Jahren