Commit Graph

3551 Commits

Author SHA1 Message Date
Juliusz Chroboczek 98ea0addb0 Fix incorrect use of tr_timerAdd. 2011-02-18 00:23:49 +00:00
Juliusz Chroboczek c5e3cfecb9 Participate in UTP.
This adds code to participate in the UTP protocol, but without doing anything
useful yet -- we just shut down immediately any incoming connexion request.
2011-02-18 00:23:47 +00:00
Jordan Lee ee4317600d (trunk libT) #3767 "rarest first policy" -- disable the assertReplicationCountIsExact() assertion 2011-02-17 13:00:11 +00:00
Jordan Lee 77bdb6522d (trunk libT) #3767 "rarest first policy" -- possible fix for assertion error reported by rolcol
Resolve the problem described @ https://trac.transmissionbt.com/ticket/3767#comment:38
2011-02-17 12:57:36 +00:00
Jordan Lee 4e60838434 (trunk libT) #3767 "rarest first policy" -- remove some debugging code.
My initial thinking was to let nightly users test this out, but it's not necessary.
2011-02-17 07:10:20 +00:00
Jordan Lee 5dffc2814d (trunk libT) #3767 "rarest first policy" -- fixed.
This commit, started by a patch from athy, implements a rarest first policy when deciding which pieces to request from peers. It keeps a count of how many peers have each piece, and updates the count when getting bitfields, have, have all, and have none messages, as well as decrementing the counts when peers disconnect.

This running total is generated only for downloading torrents. Seeds don't have this overhead.
2011-02-17 05:14:53 +00:00
Jordan Lee 716a3c90c2 (trunk) #4032 "Better error detection / reporting in http announces" -- added to trunk.
This patch adds two new flags to the callback function -- did_connect and did_timeout -- that are calculated inside of web.c using information from libcurl. This allows the announcer to detect timeouts more accurately and also to distinguish between unresponsive peers (which get the preexisting "Tracker did not respond" error message) and unconnectable peers (which get a new error message, "Could not connect to tracker").
2011-02-17 02:26:24 +00:00
Juliusz Chroboczek 6cf281a311 Make the initial DHT bootstrap more persistent.
We now try to contact the bootstrap nodes up to six times.
A better solution might be to reattempt bootstrap every half hour
or so.  This might be beneficial to people whose connectivity
changes while Transmission is running.
2011-02-15 19:10:56 +00:00
Jordan Lee d591767941 (trunk libT) #3656 "endgame could be faster" -- fixed. Patch by harrydb. 2011-02-15 16:04:56 +00:00
Jordan Lee 72f9ab91fa (trunk) make tr_torrentName() a public function.
This has been a private function in libtransmission for awhile now but it makes more sense as a public function.
2011-02-15 15:18:51 +00:00
Jordan Lee e187ae58a9 (trunk libT) #4016 "blocklists don't handle overlapping/unsorted rules" -- fixed. 2011-02-13 16:14:31 +00:00
Jordan Lee 8a6f768999 (trunk libT) rename "tr_ip_range" as "tr_ipv4_range" in blocklist.c 2011-02-12 21:20:19 +00:00
Jordan Lee 2b8124d3ad (trunk) #4019 "Minor patch, kill useless casts in transmission source." -- fixed. patch by jlouis
jlouis used Coccinelle to scan transmission's source for redundant code that casts a type to its own type.
2011-02-12 17:27:47 +00:00
Jordan Lee 3f9886c3dd (trunk libT) silence compiler warning in libtransmission/fdlimit.c: "ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result" 2011-02-09 05:34:23 +00:00
Jordan Lee adf5a2e273 (trunk libT) fix gcc compiler warning in libtransmission/makemeta.c: "ignoring return value of ‘read’, declared with attribute warn_unused_result" 2011-02-09 05:16:37 +00:00
Jordan Lee 984ac1b92e (trunk libT) fix compiler warning: "peer-io.h:282: warning: inlining failed in call to ‘evbuffer_add_uint8’: optimizing for size and code size would grow" 2011-02-09 02:35:16 +00:00
Jordan Lee 0bd1ec8de8 (trunk libT) #3991 "connection encryption stopped working" -- silence minor compiler warning. patch by ijuxda. 2011-02-09 02:26:35 +00:00
Jordan Lee 441b8fa18b (trunk libT) #3993 "Version (-V) option no longer outputs svn revision no." -- fixed.
update-version-h.sh tries to use {{{svnversion}}} when possible. But when it's not, it looks through the "$Id:" lines in the source file comments and uses the largest version number it finds. The new files tr-dht.[ch] didn't have the line of its $Id: comment formatted in the way update-version-h.sh expected. tr-dht.[ch]'s $Id: line has been homogenized to be like everyone else's...
2011-02-08 04:17:33 +00:00
Jordan Lee 394fed632f (libT) #3991 "Connection encryption stopped working" -- fixed.
This is a pretty straightfoward bug: the call to evbuffer_peek() should not have been wrapped in assert().
2011-02-08 00:31:50 +00:00
Jordan Lee 2b905bdbcc (trunk libT) silence minor "unused function argument" compiler warning 2011-02-07 23:09:36 +00:00
Jordan Lee ce08e00e2e (trunk libT) #3975 "tr_bencToFile() contains unnecessary calls to stat() and unlink()" -- fixed for win32.
remove() doesn't have the same behavior on Windows. On that platform, we should use MoveFileEx( oldpath, newpath, MOVEFILE_REPLACE_EXISTING )." Thanks to rb07 for testing & confirming the fix.
2011-02-06 18:56:44 +00:00
Jordan Lee 1fabb9b9ea (trunk) #3675 "Not all .part files are removed" -- handle trashing files via RPC.
When libtransmission gets a "remove torrent" request from RPC, it tries to delegate the work. This is because the GTK+ and Mac clients don't want torrents disappearing in a different thread and causing possible thread issues. So the GTK+ and Mac clients get notification about this via libtransmission's RPC callback and remove the torrents themselves. Unfortunately, that notification doesn't include information about whether or not to delete local data.

This commit adds that information to the RPC callback so that the Mac and GTK+ clients will know whether or not to trash the local files when a third-party RPC client requests that at torrent and its files be deleted.
2011-02-06 17:30:46 +00:00
Jordan Lee 11c0517cc8 (trunk libT) #3931 "'Announce is Queued' but doesn't get announced" -- remove the 'unresponsive tracker' penalty from torrents whose announce time has been reached.
The 'bad tracker' penalty was introduced in 2009 after a top tier trackers went down. Announces to it would hang, tying up an announce slot in libcurl for minutes at a time. If a user had enough torrents from that tracker, it could bottleneck all announce slots. The workaround was to deprioritize failing trackers so that they wouldn't obstruct other trackers.

Its implementation could be better, however. There are two parts:

  1. Deciding how frequently to retry unresponsive trackers

  2. Once an unresponsive tracker announce was ready to go, it would be bumped down the queue if other announces were ready too.

Part 2 probably contributes to #3931. If there are enough torrents loaded, there will always be good tracker announces that get pushed ahead of a bad one in the queue. Modifying 2's heuristics would be one option, but it seems simpler to remove it altogether now that getRetryInterval() grades more hashly for consecutive failures. Altering the retry interval also gives better visual feedback to users than Part 2 did.

This commit removes "Part 2" as described above.
2011-02-05 18:46:10 +00:00
Jordan Lee ddfb113f70 (trunk libT) announcer.c cleanup, part 1
Separating this commit into a few different stages. This one is superficial/readability changes, such as grouping related functions together.
2011-02-05 16:45:06 +00:00
Jordan Lee af1e920ab7 (trunk libT) minor futzing: remove unnecessary "assert( tr_isTorrent( tor ) );" calls
Remove these calls from private functions whose callers have already asserted the same thing.
2011-02-03 22:53:02 +00:00
Jordan Lee deac8fedbe (trunk libT) now that bencode.c doesn't call stat() anymore, we can remove a couple of #includes 2011-02-03 06:19:54 +00:00
Jordan Lee 2450d6514b (trunk libT) #3519 "Webseeds don't work" -- handle nonresponsive webseeds
Don't keep trying to use nonresponsive webseeds or it will generate unnecessary network traffic and kill us during endgame.
2011-02-03 04:17:48 +00:00
Jordan Lee 3282e1ea81 (trunk libT) #3975: "tr_bencToFile() contains unnecessary calls to stat() and unlink()" -- fixed.
When saving a tr_benc object to disk at $dst, bencode.c saves it to a tmp file in the same directory as $dst, unlinks $dst if it exists, and then renames $tmp as $dst. This commit removes the middle step, which is unnecessary because rename() has guarantees about atomically overwriting $dst.
2011-02-03 00:48:05 +00:00
Jordan Lee e8614030a2 (trunk libT) #3973 "JIT verification verifies fresh downloaded torrents" -- remove a debugging printf() statement that shouldn't have been checked in. 2011-02-02 23:33:25 +00:00
Jordan Lee 22660ed751 (trunk libT) #3973 "JIT verification verifies fresh downloaded torrents" -- improvement to r11813.
r11813 fixed the timestamp issue by fsync()ing files before close()ing them in tr_close_file(). This causes a little overhead as even read-only files cause a sync as their atimes are modified. Instead, we should call fsync() further back in the call chain in tr_fdFileClose() so that we can know to only sync torrent files that were opened with write access.
2011-02-02 23:29:17 +00:00
Jordan Lee 4bf6f0ac40 (trunk libT) #3973 "JIT verification verifies fresh downloaded torrents" -- win32 portability fix for r11813.
fsync() doesn't exist on Windows. bencode had a private function, tr_fsync(), that is a portability wrapper around fsync() on *nix and _commit() on win32. Make this function package-visible, rather than private, so fdlimit.c can use it too.
2011-02-02 23:19:54 +00:00
Jordan Lee 06948a8514 (trunk libT) #2955 "verify pieces only when necessary, or when the user requests it." -- improvements to .resume file
As pointed out by longinus00 and ijuxda, storing per-piece timestamps in the .resume file can involve a lot of overhead. This commit reduces the overhead by adding a couple of optimizations: (1) in cases where *all* or *none* of the files' pieces were checked after the file's mtime, we can safely fold all the pieces' mtimes into a single per-file mtime. (2) since unix time takes up a lot of space when rendered as a benc integer, find a common per-file "baseline" number, then store the pieces' timestamps as offsets from that number.  Also add documentation explaining this new format, and also better explaining the pre-2.20 progress format.
2011-02-02 21:17:16 +00:00
Jordan Lee 5fc1ff8855 (trunk libT) #3973 "JIT verification verifies freshly-downloaded torrents" -- test fix.
Files downloaded in Transmission 2.20 betas [1..3] forced each piece to be checked twice -- once on download, and once when uploading the piece for the first time. Older versions of Transmission didn't perform the latter check unless the file had changed after it was downloaded. This commit restores that behavior.
2011-02-02 20:30:04 +00:00
Jordan Lee 859570345d (trunk libT) tweak the documentation on a couple of structs 2011-02-02 17:15:41 +00:00
Jordan Lee 4736d863bf (trunk libT) minor code cleanup to inout.c's readOrWriteBytes().
Use ijuxda's suggestion of making the fstat(fd) call dependent on (fd>=0) rather than (!err).
2011-02-02 06:06:09 +00:00
Jordan Lee fc1c5fe553 (trunk libT) silence some unused variable warnings from gcc when building with -DNDEBUG 2011-02-02 05:18:33 +00:00
Jordan Lee ba7e856ce2 (trivial) make the implementation of tr_torPieceCountBlocks(), tr_torPieceCountBytes(), and tr_torBlockCountBytes() consistent. 2011-02-01 21:32:03 +00:00
Jordan Lee ee849ab82b (trunk libT) #3956 "tr_bencFree() could be faster" -- fix memory error.
#3956's r11780 has uncovered a longstanding memory error that occurs when tr_bencParse() fails to parse a dict and leaves a dangling key. This is fixed by cleaning up the key.
2011-02-01 17:56:19 +00:00
Jordan Lee 8f69a33c79 (trunk libT) #3836 "libevent 2 support" -- fix minor memory leak.
tr_peerIoReconnect() was calling event_del() rather than event_free() on its io.event_read and io.event_write fields, causing those fields to be leaked. This behavior is new with libevent 2 support and doesn't affect transmission 2.1x or older.
2011-02-01 17:12:20 +00:00
Jordan Lee 2f5fc4ade7 (trunk libT) #3959 "by default, disable prefetch for lightweight builds" -- fixed.
User jusid reports prefetch causes load on his NMT to jump from <1 to 3-4. He requests a way to disable prefetch, and suggests that prefetch be disabled by default on lightweight builds.  This commit adds a new settings.json key, "prefetch-enabled", which defaults to "true" on standard builds and "false" when compiled with --enable-lightweight.
2011-01-31 23:35:10 +00:00
Jordan Lee 392df7ceb8 (trunk libT) #3969 "tr_base64_encode() has unnecessary overhead with linefeeds" -- fixed.
Don't add linefeeds to base64-encoded data. We don't need it and it just increases the length of the string, which is typically sent over the network to an RPC client.
2011-01-31 22:47:07 +00:00
Jordan Lee 9ed800c45a (trunk libt) #3968 "tr_cpFileIsComplete could be faster" -- fixed.
Rewriting this function as described in ticket #3968. This rewrite drops it from 1.77% of cpu use to 0.07%.
2011-01-31 16:43:37 +00:00
Jordan Lee a9e104d591 (trunk libT) #3931 "announce is queued" -- minor revision for uClibc compatibility
jusid reports that powl() doesn't exist on uClibc, so getRetryInterval() needs to work without it. A simple left-bit shifting would be fine, but since we max out after a handful of cases, a switch statement seems slightly more readable than shifting or powl().
2011-01-30 16:23:53 +00:00
Jordan Lee e7f81543ec (trunk libT) #3961 "Support for running scripts when a torrent finishes downloading on Windows" -- fixed. patch by rb07
The changes to torrentCallScript() weren't portable to Windows, so rb07 has provided a patch.
2011-01-30 01:41:48 +00:00
Jordan Lee 69d99f252f (trunk libT) #2363 "daemon on mac moves config files on first launch" -- fixed.
Don't run platform.c's migrateFiles() except on *nix platforms. Add comment explaining when the function is used and why.
2011-01-30 01:33:53 +00:00
Jordan Lee e492bcf7d0 (trunk libT) "Announce is Queued" but torrent doesn't announce itself to trackers -- simplify http response code handling 2011-01-29 19:04:02 +00:00
Jordan Lee 4fbd6d8b19 (trunk libT) #3950 "use libevent's cached gettimeofday() value when appropriate" -- fixed. 2011-01-29 18:59:23 +00:00
Jordan Lee 5b23aae320 (trunk libT) memory cache should use evbuffers to avoid unnecessary calls to memcpy -- done. 2011-01-29 18:56:53 +00:00
Jordan Lee bbe51e1faf (trunk libT) #3955 "tr_torrentNext() should be inlined" -- fixed. 2011-01-29 18:54:43 +00:00
Jordan Lee 56a81ab172 (trunk libT) #33956 "tr_bencFree() could be faster" -- fixed.
benc requires its dictionaries to be represented in a sorted form, so we sort them before walking across the entries. However that's overkill when all we're doing is freeing memory, so this commit adds a mechanism in the benc walker to optionally avoid the sorting overhead.
2011-01-29 18:14:35 +00:00