about summary refs log tree commit diff
AgeCommit message (Collapse)Author
2006-02-05Add functions read_fully and write_fully. They are simpler alternatives toRichard Nyberg
read and write on blocking sockets.
2006-02-05Add a function to look up a torrent by its number.Richard Nyberg
2006-02-05Each torrent now gets a number. This number is used to select which torrentRichard Nyberg
to operate on from btcli.
2006-02-05Add function to get tracker error count. Don't look for peers and stuffRichard Nyberg
in tracker replies when we're stopping.
2006-02-05Help text changes.Richard Nyberg
2006-02-01Torrents can now be deactivated and btpd will wait for all torrents toRichard Nyberg
deactivate on shutdown. To not risk hanging indefinitely on unresponsive trackers, btpd will cancel tracker requests after a while.
2006-02-01o Fixed: cm->active was not set to 0 in cm_stop.Richard Nyberg
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.
2006-02-01Peers we download from are given a weight of two compared to peers we seed toRichard Nyberg
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.
2006-02-01Added function http_redo, which does a new request for the same url as anRichard Nyberg
old request and cancels the old request.
2006-01-25* Better message when trying to start btpd in a driectory where it's alreadyRichard Nyberg
running. * Added --downloaders and --max-peers options and hopefully usefull defaults. Because curl uses fd_sets it's important to keep the numbers of fds used below FD_SETSIZE. I will probably move the curl stuff to it's own process to get rid of that limitation. * Added to the help text.
2006-01-24Don't clear the bitfield for blocks it's possible we have, even thoughRichard Nyberg
the resume file and content aren't synchronized. Save the resumefile every 15 seconds for torrents we're downloading. This way we don't have to redownload much content because of crash or whatnot. Not that btpd would crash :) Also, as there were probably no point in fsync'ing the content when we closed the write stream, that is not done anymore.
2006-01-22* Implemented the full cm_ life cycle.Richard Nyberg
* Added fast resume support. A resume file is loaded when a torrent is started and saved when it's stopped or done. If no resume file is found or the file information doesn't match whats on disk, the content is tested for existing pieces. * cm_prealloc now can allocate several adjacent pieces to the given piece. This further reduces fragmentation. How many pieces are allocated at a time is controlled by cm_alloc_size which can be set by the user with the --prealloc option. * Some changes were also made to the torrent api.
2006-01-22Added option --prealloc and a directory argument to btpd. Synced the commandRichard Nyberg
line help with the available options.
2006-01-22Added vfsync and vfopen.Richard Nyberg
2006-01-17White space.Richard Nyberg
2006-01-16Implemented a service thread for operations such as testing piece hashes,Richard Nyberg
preallocating disk space, etc. Tweaked the cm <-> net api a bit.
2006-01-16Unify the write and read structs. There was no good reason to keep themRichard Nyberg
separate. Improve the bts_seek so that it only calls close or lseek if necessary. Otherwise it's a nop. Hide bts_seek and instead make the offset explicit in calls to bts_get or bts_put.
2006-01-16peer_on_no_reqs was called unsafely in peer_on_choke. It should only beRichard Nyberg
called after removing the last request.
2006-01-16There should be one level of pointer indirection less for the argumentsRichard Nyberg
of rate_cmp. Also the wrong variable was passed to peer_unchoke. s/unsigned/int where it makes sense.
2006-01-16Add peer_full function.Richard Nyberg
2006-01-16A peer needs to be removed from the peer list before being handed toRichard Nyberg
dl_on_lost_peer. Fix a type.
2006-01-16Fix conditional I broke in r131.Richard Nyberg
2006-01-10Removed code dealing with child processes; btpd doesn't use them anymore.Richard Nyberg
2006-01-10Changed semantics of cancelled http requests. Before they were reportedRichard Nyberg
as cancelled, or possibly ok or failed if the request had come that far. Now cancelled requests are silently discarded and doesn't execute the callback. This makes the http api easier to use. Updated the tracker code for the new http semantics.
2006-01-09* Move the network related parts of the torrent struct to a sub struct.Richard Nyberg
* Move some struct and type definitions to net_types.h * Fix ul_on_lost_peer. I must've been very tired when I wrote it :P
2006-01-09Fix compiler warnings.Richard Nyberg
2006-01-09Rename tp->cp to tp->cm.Richard Nyberg
2006-01-09Rename p->net to p->in and net_state to input_state. Move code to where itRichard Nyberg
belongs.
2006-01-09Better tracker code. Mostly done but needs a little more work.Richard Nyberg
It now uses the new http thread instead of forked proceses for tracker requests.
2006-01-09Move finished http requests to a queue and post the whole queue at once.Richard Nyberg
This can potentially reduce the time the http thread keeps the post lock and the httpq lock.
2006-01-08OMG! It's a new year already! ;)Richard Nyberg
Update the copyright.
2006-01-07Nicer code for the http thread.Richard Nyberg
2006-01-06* Added a method for other threads to execute callbacks in the main thread.Richard Nyberg
* Added a thread and api for http requests. The thread uses the curl multi interface and will be used by the tracker code. The tracker code currently use forked processes to do its bidding.
2006-01-06Added BTPDQ_FOREACH_MUTABLE list macro.Richard Nyberg
2006-01-06Sort.Richard Nyberg
2006-01-04Remove use of the ugly PRI* print macros.Richard Nyberg
2006-01-04o Use the new cm_* content api.Richard Nyberg
o Unhook cli_if.c from build temporarily. It needs to be fixed. o Torrent meta data is now kept in subdirectories to $BTPD_HOME/library. o Added some very incomplete life cycle logic for torrents.
2006-01-04New api for managing the content of a torrent. It'll keep track of whichRichard Nyberg
pieces we and blocks we have, it'll do the writing and reading from disk and test pieces against their hashes. This is only a dummy implementation of the api. I'll flesh it out in subsequent commits.
2006-01-04Don't write the rates to the log anymore.Richard Nyberg
2006-01-04Fixed a broken loop. I must have forgotten that the loop variable wasRichard Nyberg
unsigned when I wrote it :P
2006-01-03o Removed an unused function.Richard Nyberg
o Made bit field argument to has_bit const since the function doesn't modify it.
2005-12-17First stab at a choke algorithm for all peers. In previous versions chokingRichard Nyberg
was done per torrent.
2005-12-14Add and use rand_between.Richard Nyberg
2005-12-02* Some code shuffle and removal of dead code.Richard Nyberg
* Add net_active flag to simplify removal of peers when shutting down the net for a torrent.
2005-12-01Rates should be unsigned long. Compute total, torrent and peer rates.Richard Nyberg
2005-12-01dl_on_lost_peer must remove the peer from the list. This was accidentallyRichard Nyberg
removed in a previous commit. Fix indentation.
2005-12-01Fix an unsafe loop.Richard Nyberg
2005-11-30The mega whitespace patch.Richard Nyberg
Tabs have been converted to spaces and trailing whitespace have been removed. I have fixed my emacs settings now :P
2005-11-30* Added net_(add|del)_torrent. net_add_torrent enables p2p for a torrentRichard Nyberg
and net_del_torrent does the opposite (surprise!). * Some code shuffle has been done to separate net_ and dl_ from torrent_ but there's still much to be done. * Removed a couple of dead vars from struct torrent.
2005-11-29* Removed the heartbeat and btpd_seconds. Note that this breaks the tracker.Richard Nyberg
* Renamed the policy* files to upload* and download*. * The upload (un)choker is now global instead of per torrent. The algorithm is not yet implemented however. To be continued...