Commit Graph

3569 Commits

Author SHA1 Message Date
Jordan Lee c4b1d1e6c5 (trunk libT) add C and RPC API for getting/setting uTP enabled flag 2011-02-18 00:33:11 +00:00
Jordan Lee 3a7806a7cc (trunk libT) silence compiler warnings 2011-02-18 00:32:39 +00:00
Jordan Lee 7df7d34f6d automake/autoconf; #includes in libtransmission 2011-02-18 00:32:19 +00:00
Juliusz Chroboczek 130006fcb1 Propagate uTP and ut_holepunch information over PEX. 2011-02-18 00:24:48 +00:00
Juliusz Chroboczek 5a2710c9da Use dummy callbacks in peerIoReconnect. 2011-02-18 00:24:45 +00:00
Juliusz Chroboczek 44e6e4a8f2 Tweak dummy callbacks.
Don't abort, just log a message and continue.
2011-02-18 00:24:40 +00:00
Juliusz Chroboczek 4d5f8dbb92 Don't call UTP_Close multiple times.
Greg says it's evil.
2011-02-18 00:24:36 +00:00
Juliusz Chroboczek eb715e8018 Shutdown UTP socket on short write. 2011-02-18 00:24:30 +00:00
Juliusz Chroboczek c9bbab05ee Schedule a uTP write in peerIoWriteBuf. 2011-02-18 00:24:28 +00:00
Juliusz Chroboczek 1090e5a262 Complete the uTP callbacks. 2011-02-18 00:24:22 +00:00
Juliusz Chroboczek 6313eb4703 Add dummy UTP callbacks.
Libutp will sometimes call our callbacks after we called UTP_Close,
notably to notify us of the UTP_STATE_DESTROYING state change, but
also, for some reason, to ask us about our read buffer.  The simplest
way to avoid issues with that is to switch to a second set of callbacks.
2011-02-18 00:24:18 +00:00
Juliusz Chroboczek 5563729d61 Add assertions to libevent callbacks.
They should never be called with a UTP socket.
2011-02-18 00:24:15 +00:00
Juliusz Chroboczek 18f1ddb7aa First pass at uTP callbacks. 2011-02-18 00:24:13 +00:00
Juliusz Chroboczek 1cfa2ac38b Update tr-utp.c to be compatible with libevent2. 2011-02-18 00:24:11 +00:00
Juliusz Chroboczek 5ad27d82cf Fix io_dtor for uTP sockets. 2011-02-18 00:24:09 +00:00
Juliusz Chroboczek 87d1f5ca34 Check for UTP timeouts every 50ms or so.
Greg says that works for them.
2011-02-18 00:24:04 +00:00
Juliusz Chroboczek 7741151c48 Accept UTP connexions. 2011-02-18 00:23:58 +00:00
Juliusz Chroboczek 8599d7c037 Modify peer-io to work with UTP sockets.
This is not supposed to work yet -- it just adds new fields to the data
structures to get the UTP code to compile.
2011-02-18 00:23:51 +00:00
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