Commit Graph

  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • *
  • 476765a Added option --prealloc and a directory argument to btpd. Synced the command line help with the available options. by Richard Nyberg 2006-01-22 21:57:04 +0000
  • 59bed6c Added vfsync and vfopen. by Richard Nyberg 2006-01-22 21:51:13 +0000
  • b2a8775 White space. by Richard Nyberg 2006-01-17 10:20:39 +0000
  • d324b49 Implemented a service thread for operations such as testing piece hashes, preallocating disk space, etc. Tweaked the cm <-> net api a bit. by Richard Nyberg 2006-01-16 22:32:04 +0000
  • a3933c0 Unify the write and read structs. There was no good reason to keep them 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. by Richard Nyberg 2006-01-16 22:23:26 +0000
  • 66d742a peer_on_no_reqs was called unsafely in peer_on_choke. It should only be called after removing the last request. by Richard Nyberg 2006-01-16 21:30:54 +0000
  • cdd5e3f There should be one level of pointer indirection less for the arguments of rate_cmp. Also the wrong variable was passed to peer_unchoke. s/unsigned/int where it makes sense. by Richard Nyberg 2006-01-16 20:29:28 +0000
  • 1c14af0 Add peer_full function. by Richard Nyberg 2006-01-16 19:47:05 +0000
  • 3c0e61e A peer needs to be removed from the peer list before being handed to dl_on_lost_peer. Fix a type. by Richard Nyberg 2006-01-16 17:13:19 +0000
  • 49da7ac Fix conditional I broke in r131. by Richard Nyberg 2006-01-16 17:05:30 +0000
  • 6f09434 Removed code dealing with child processes; btpd doesn't use them anymore. by Richard Nyberg 2006-01-10 17:57:03 +0000
  • 8aed86f Changed semantics of cancelled http requests. Before they were reported 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. by Richard Nyberg 2006-01-10 15:05:44 +0000
  • 2d21101 * Move the network related parts of the torrent struct to a sub struct. * 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 by Richard Nyberg 2006-01-09 21:20:14 +0000
  • 0aa0975 Fix compiler warnings. by Richard Nyberg 2006-01-09 21:03:38 +0000
  • 350f8ad Rename tp->cp to tp->cm. by Richard Nyberg 2006-01-09 17:52:30 +0000
  • 2e63eaf Rename p->net to p->in and net_state to input_state. Move code to where it belongs. by Richard Nyberg 2006-01-09 16:41:54 +0000
  • 5377243 Better tracker code. Mostly done but needs a little more work. It now uses the new http thread instead of forked proceses for tracker requests. by Richard Nyberg 2006-01-09 13:41:07 +0000
  • d4082e3 Move finished http requests to a queue and post the whole queue at once. This can potentially reduce the time the http thread keeps the post lock and the httpq lock. by Richard Nyberg 2006-01-09 13:31:21 +0000
  • e8a016d OMG! It's a new year already! ;) Update the copyright. by Richard Nyberg 2006-01-08 11:57:54 +0000
  • de29f2e Nicer code for the http thread. by Richard Nyberg 2006-01-07 14:55:34 +0000
  • 7f8f5dd * Added a method for other threads to execute callbacks in the main thread. * 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. by Richard Nyberg 2006-01-06 22:24:25 +0000
  • 74b665e Added BTPDQ_FOREACH_MUTABLE list macro. by Richard Nyberg 2006-01-06 18:49:47 +0000
  • 75e9db3 Sort. by Richard Nyberg 2006-01-06 11:57:10 +0000
  • 1eea765 Remove use of the ugly PRI* print macros. by Richard Nyberg 2006-01-04 19:59:47 +0000
  • 49e90df o Use the new cm_* content api. 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. by Richard Nyberg 2006-01-04 13:38:22 +0000
  • 56320bc New api for managing the content of a torrent. It'll keep track of which 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. by Richard Nyberg 2006-01-04 12:16:31 +0000
  • 0cbe077 Don't write the rates to the log anymore. by Richard Nyberg 2006-01-04 11:53:01 +0000
  • 3f8dd2e Fixed a broken loop. I must have forgotten that the loop variable was unsigned when I wrote it :P by Richard Nyberg 2006-01-04 11:16:03 +0000
  • 2d2f8b0 o Removed an unused function. o Made bit field argument to has_bit const since the function doesn't modify it. by Richard Nyberg 2006-01-03 22:28:07 +0000
  • 24650e5 First stab at a choke algorithm for all peers. In previous versions choking was done per torrent. by Richard Nyberg 2005-12-17 22:07:06 +0000
  • b2bf61d Add and use rand_between. by Richard Nyberg 2005-12-14 17:31:16 +0000
  • c347106 * Some code shuffle and removal of dead code. * Add net_active flag to simplify removal of peers when shutting down the net for a torrent. by Richard Nyberg 2005-12-02 13:18:39 +0000
  • 00fc2ce Rates should be unsigned long. Compute total, torrent and peer rates. by Richard Nyberg 2005-12-01 14:41:35 +0000
  • cbc1a81 dl_on_lost_peer must remove the peer from the list. This was accidentally removed in a previous commit. Fix indentation. by Richard Nyberg 2005-12-01 14:39:29 +0000
  • 7a5d04e Fix an unsafe loop. by Richard Nyberg 2005-12-01 13:56:43 +0000
  • c285b37 The mega whitespace patch. Tabs have been converted to spaces and trailing whitespace have been removed. I have fixed my emacs settings now :P by Richard Nyberg 2005-11-30 20:53:00 +0000
  • 9bfcc80 * Added net_(add|del)_torrent. net_add_torrent enables p2p for a torrent 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. by Richard Nyberg 2005-11-30 20:45:26 +0000
  • 005ce9d * Removed the heartbeat and btpd_seconds. Note that this breaks the tracker. * 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... by Richard Nyberg 2005-11-29 13:58:19 +0000
  • a01ffd8 * Get rid of net_bw_hz and run the bw stuff at one hz. * The peer rates are now only updated when data transfer is enabled in the corresponding direction. They are also computed differently from before. The rates are computed in the bw callback once a second. This facilitates later improvements in the choke algorithm. by Richard Nyberg 2005-11-27 20:26:11 +0000
  • a93803c More name changes from "cm_" to more appropriate names. by Richard Nyberg 2005-11-27 15:43:51 +0000
  • f14c6c2 Rename the list of torrents. by Richard Nyberg 2005-11-27 12:28:57 +0000
  • db4e9b8 This is very much a intermediate commit. * Load "test" torrent on start. * Look for content and resume in the right places. by Richard Nyberg 2005-11-27 12:18:44 +0000
  • 3f6d757 Use a flag (PF_DO_UNWANT) to indicate that we should send an uninterest message when we no longer have any pending requests. This fixes a bug where two uniterest messages were sent to a peer that was no longer wanted in endgame. by Richard Nyberg 2005-11-14 20:54:55 +0000
  • c46a6b4 Just bump version number. by Richard Nyberg 2005-11-07 14:58:25 +0000
  • 71b986e Step one of many to make the sub systems more modular. This commit gets rid of the global btpd struct. Some fields in the struct got a corresponding global variable whereas some was made static and moved to a module. by Richard Nyberg 2005-11-07 14:57:39 +0000
  • 8033ec3 Set version to 0.7. Update CHANGES. by Richard Nyberg 2005-10-10 16:57:10 +0000
  • e025c47 Add a new net state to get the index and begin fields from piece messages before we read the piece data. This can be used to test for junk earlier. by Richard Nyberg 2005-10-08 19:08:10 +0000
  • 0cae0e4 Have a peer event for keep alives too. Its only function is to log atm. by Richard Nyberg 2005-10-08 15:31:22 +0000
  • e5cd773 Wait until we don't have any unanswered requests on a peer before sending an uninterest message. by Richard Nyberg 2005-10-08 15:27:07 +0000
  • 87f94f9 Log keep alives. by Richard Nyberg 2005-10-08 15:03:48 +0000
  • a263d2f Accept pieces even if they arrive in a different order than the requests were sent. by Richard Nyberg 2005-10-08 14:50:40 +0000
  • 74c5b19 Logging. by Richard Nyberg 2005-10-08 14:32:09 +0000
  • 93053ce Remove unsent requests from the write queue when we receive a choke. by Richard Nyberg 2005-10-08 10:00:30 +0000
  • a8817ee Enable all logging if DEBUG is defined. by Richard Nyberg 2005-10-06 14:09:39 +0000
  • 89b0b8b More logging: discarded pieces and peer_id. by Richard Nyberg 2005-10-06 14:01:55 +0000
  • 28fcbed #include <limits.h> to be sure to get IOV_MAX. Use the net_state enum and change some state names from NET_ to BTP_. Some minor type fixes. by Richard Nyberg 2005-10-06 08:16:43 +0000
  • 2dc98c3 Fix two bugs. Add some logging. by Richard Nyberg 2005-10-05 12:01:37 +0000
  • e982934 Remove unused constants. by Richard Nyberg 2005-10-05 11:59:48 +0000
  • 80214ff Code shuffle. by Richard Nyberg 2005-10-05 08:59:01 +0000
  • 9ba7dc6 Put the net state related data in its own sub struct. Remove unneccesary use of struct io_buffer. by Richard Nyberg 2005-10-05 08:47:42 +0000
  • 2bc4a5d Constify some functions. Remove an unneccesary net state. Pass the char buffer directly to net_state instead of struct io_buf. by Richard Nyberg 2005-10-05 08:23:49 +0000
  • 062d08c net_state should return ssize_t not int. removed some deug logging. by Richard Nyberg 2005-10-04 19:21:08 +0000
  • f963072 Better method of reading data from peers. btpd could send data to peers that had closed the at least one direction of the connection. That feature was probably unneccesary. Removed it for now. by Richard Nyberg 2005-10-04 19:14:35 +0000
  • 32a88ff Rewrite of the code for receiving data from peers. It's not quite how I want it yet, but it's getting there. by Richard Nyberg 2005-10-04 17:52:56 +0000
  • d5bf714 More logging. by Richard Nyberg 2005-10-01 16:29:44 +0000
  • 777c7e6 Changes for 0.6. by Richard Nyberg 2005-09-30 12:47:06 +0000
  • faad18e In the transition to end game it's likely that we'll send an uniterest message followed by an interest message. Optimize this but not sending those messages in that case. This is better becasue we don't risk to trigger a choke from the receiving peer. by Richard Nyberg 2005-09-24 18:59:24 +0000
  • aa1fe4b Send a new request to a peer after sending cancel. by Richard Nyberg 2005-09-23 10:29:45 +0000
  • 6bf0279 x by Richard Nyberg 2005-09-21 19:05:59 +0000
  • 2123189 Bump version to 0.6. by Richard Nyberg 2005-09-21 10:55:04 +0000
  • f31e2d8 * Allocate request messages on piece creation. The request objects can be shared by several peers. At least in end game. * Link blocks with the peers we are loading them from and vice versa. * Limit the number of requests / peer in end game too. * Improve end game by using some sort of round robin for block requests. by Richard Nyberg 2005-09-20 19:24:11 +0000
  • d8720e8 Use the piece destructor. by Richard Nyberg 2005-09-20 19:04:39 +0000
  • dc45054 Add some macros. by Richard Nyberg 2005-09-20 18:54:20 +0000
  • a67eaf4 Simplify the autocrap somewhat. Always include the #defines needed to build with glibc. by Richard Nyberg 2005-09-10 19:25:17 +0000
  • 08dcc6b Remove a bad assert. The test can be true during normal operation. by Richard Nyberg 2005-08-30 08:18:11 +0000
  • eaf9533 Set an upper limit on how many piece messages to queue for writing to a peer. If more requests arrive they will be ignored. When all pieces have been sent to the peer, in order for it not to wait on the ignored requests, its state will be reset by a choke followed by an unchoke message. by Richard Nyberg 2005-08-12 20:25:52 +0000
  • fcbec72 Only allocate one have message for all peers, instead of one per peer. by Richard Nyberg 2005-08-03 21:08:04 +0000
  • 2acdcff * Rearrange some code. Mostly from net to net_buf and peer. * Use the new net_bufs where it makes sense. * Take advantage of the reference count on net_bufs and only allocate the (un)choke and (un)interest messages once. by Richard Nyberg 2005-08-02 17:05:25 +0000
  • e485377 The fix for bitfield in r59 wasn't quite correct. Instead of being sent too early it could now be sent too late. by Richard Nyberg 2005-08-02 14:53:23 +0000
  • 8115e48 Wrong logmask was used. by Richard Nyberg 2005-07-31 17:42:07 +0000
  • 77177de Set version to 0.4. by Richard Nyberg 2005-07-31 17:03:47 +0000
  • 0537ec3 Add items for 0.4. by Richard Nyberg 2005-07-31 17:03:02 +0000
  • 01191f2 Spelling. by Richard Nyberg 2005-07-30 19:02:19 +0000
  • aa50cbe Removed the info entry in the net_buf. The information can easily be extracted from the buffer data instead. Created functions to do that. by Richard Nyberg 2005-07-30 18:48:52 +0000
  • 1e1846b Better tests. peer_laden is needed beacuse the peer might have gotten new request if the piece was fully downloaded and found to be bad. by Richard Nyberg 2005-07-30 18:45:20 +0000
  • c11a57b Fix style. Remove unnecessary check for EINTR. by Richard Nyberg 2005-07-30 18:42:59 +0000
  • 17a1f68 All files: Each piece must have at least one byte for their block bit array, or they will collide causing great confusion in btpd. The calculation was done wrong so this could happen for small torrents (blocks / piece < 8). by Richard Nyberg 2005-07-30 18:27:46 +0000
  • af31e76 * Don't hold a net_buf on allocation. Do it when it's really needed instead. * Add function net_unsend to safely remove network buffers from a peer's outq. Use it where needed in peer.c. by Richard Nyberg 2005-07-30 10:27:58 +0000
  • bf2c2c6 Make sure we don't empty the outq and leave the write callback enabled. by Richard Nyberg 2005-07-29 20:19:04 +0000
  • 4f916d8 Remove dead code. by Richard Nyberg 2005-07-29 19:42:09 +0000
  • 9cc1ffd Rework the outgoing network buffers. The buffers now contain more information on what data they hold, making it unnecessary to have other lists tracking that information. Also they now have a reference count, making it possible to use the same buffer on many peers. by Richard Nyberg 2005-07-29 19:40:05 +0000
  • 762b356 Missing space. by Richard Nyberg 2005-07-29 10:08:05 +0000
  • aa31f52 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. by Richard Nyberg 2005-07-29 10:07:18 +0000
  • fcc9418 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. by Richard Nyberg 2005-07-29 09:18:44 +0000
  • 3ae85c5 Spelling. by Richard Nyberg 2005-07-23 21:30:11 +0000
  • f671c4f Use the old simpler bandwidth limiter, but run it at a configurable rate. Let the default be 8 hz for now. by Richard Nyberg 2005-07-23 21:29:46 +0000
  • f65633c Set a 60s timeout on writes. If a write times ut the peer in question will be killed. by Richard Nyberg 2005-07-22 16:34:18 +0000
  • 40ffcd1 Kill a peer when write indicates a closed connection. by Richard Nyberg 2005-07-22 16:20:54 +0000
  • 1aee379 Speling. by Richard Nyberg 2005-07-22 10:40:39 +0000
  • ee7abde The assert is only valid if we haven't transitioned to end game. by Richard Nyberg 2005-07-22 10:27:17 +0000