Commit Graph

3884 Commits

Author SHA1 Message Date
Jordan Lee 7445be9a53 (trunk libT) whoops, remove 4 debugging fprintf()'s from the previous commit 2011-03-28 16:33:40 +00:00
Jordan Lee 83c0e4f011 (trunk libT) break the mac build and introduce new crashes.
This is partially to address #4145 "Downloads stuck at 100%" by refactoring the bitset, bitfield, and tr_completion; however, the ripple effect is larger than usual so things may get worse in the short term before getting better.

livings124: to fix the mac build, remove bitset.[ch] from xcode
2011-03-28 16:31:05 +00:00
Jordan Lee 1101ba8d57 (trunk libT) strip trailing whitespace 2011-03-28 13:37:46 +00:00
Jordan Lee 6c845ba5f4 (trunk libT) fix memory leak in tr_utf8clean()'s utility function to_utf8() 2011-03-28 03:45:31 +00:00
Jordan Lee b54ebeafd7 (trunk libT) remove the tr_session argument from the announce/scrape response callbacks 2011-03-26 12:06:04 +00:00
Jordan Lee 9aafb0cb00 (trunk libT) minor code cleanup in announcer-udp: whitespace & function names 2011-03-26 10:22:25 +00:00
Jordan Lee eb06d81fb9 (trunk) fix a handful of small memory leaks that valgrind found. 2011-03-25 17:42:47 +00:00
Jordan Lee bd88521332 (trunk) yet more "#include" tweaks 2011-03-25 15:03:42 +00:00
Jordan Lee 1650a4730c (trunk libT) copyediting: yes, removing more unnecessary #includes 2011-03-25 06:20:12 +00:00
Jordan Lee 1b825079be (trunk libT) API cleanup of the tr_address functions to make them more consistent.
This is loosely related to #2910, but only in the sense of laying the groundwork for #2910's fix...
2011-03-25 05:34:26 +00:00
Jordan Lee 1304aa0079 (trunk libT) still fiddling around with #includes -- this time removing unncecessary libT includes from libT .c files 2011-03-25 01:41:57 +00:00
Jordan Lee 324f0f470c (trunk libT) copyediting: '#include "crypto.h"' cleanup 2011-03-25 01:21:31 +00:00
Jordan Lee 87ef45cf3d (trunk libT) copyediting: remove a bunch of seemingly-unneeded network headers in net.[ch].
I'm less certain that these are unneeded because networking APIs seem to have more variation between platforms, but it's better to remove the cruft and then add back whatever headers $PLATFORM users complain about, than to not remove the cruft at all...
2011-03-24 22:57:39 +00:00
Jordan Lee f7005889d1 (trunk libT) copyediting: clean up the "#include <event2/*>" directives in libtransmission's header files 2011-03-24 22:45:04 +00:00
Jordan Lee 375694eda9 (trunk) copyediting: remove some unneeded #includes, and annotate some needed ones 2011-03-24 21:49:42 +00:00
Jordan Lee bc213eb0e9 (trunk libT) If transmission.h is being processed by a C++ compiler, it shouldn't #include stdbool.h 2011-03-23 18:25:41 +00:00
Jordan Lee 949241a490 (trunk libT) tr_set_func is only used in one place, so make it a private function there instead of leaving it public in utils.h 2011-03-22 23:49:29 +00:00
Jordan Lee 48212fa0b9 (trunk libT) tr_strtruncd() is only used in one place, so make it a private function there instead of leaving it public in utils.h 2011-03-22 23:46:31 +00:00
Jordan Lee 14277760d7 (trunk libT) tr_set_compare() is only used in one place, so make it a private function there instead of leaving it public in utils.h 2011-03-22 23:42:25 +00:00
Jordan Lee 503035fa7e (trunk) remove unused gcc symbol: TR_GNUC_PURE 2011-03-22 23:37:20 +00:00
Jordan Lee e5143dbf9c (trunk libT) #4136 "r12181 causes excessive disk activity and logfile bloat" -- fixed. 2011-03-22 16:50:09 +00:00
Jordan Lee b4d36aeb54 (trunk) #4138 "use stdbool.h instead of tr_bool" -- done. 2011-03-22 15:19:54 +00:00
Jordan Lee e04a64ca02 test & see if xcode/osx has stdbool.h 2011-03-22 14:45:04 +00:00
Jordan Lee 0d45f8994a (trunk libt) more transmission.h copyediting 2011-03-21 17:08:10 +00:00
Jordan Lee 41238c6c5d (trunk libT) discard out-of-range reject messages from peers. 2011-03-21 16:42:32 +00:00
Jordan Lee bf4eb642dc (trunk libT) remove dead code: tr_sessionSetLazyBitfieldEnabled(), tr_sessionIsLazyBitfieldEnabled() 2011-03-21 16:33:16 +00:00
Jordan Lee 957732c5d0 (trunk libT) copyediting in transmission.h: fix some line wraps 2011-03-21 16:26:45 +00:00
Jordan Lee b9a508f9fe (trunk libT) remove unused configDir argument from tr_sessionGetDefaultSettings() 2011-03-21 16:22:39 +00:00
Jordan Lee a9f1c9a5a6 (trunk libT) tweak comments to fix inconsistent capitalization 2011-03-20 15:56:32 +00:00
Jordan Lee b16458e038 (trunk libT) #117 "UDP tracker support" -- fix add-UDP-tracker-URL-via-RPC bug reported by johnea @ https://trac.transmissionbt.com/ticket/117#comment:79 2011-03-20 15:42:54 +00:00
Jordan Lee 40defc8fb2 (trunk libT) #117 "UDP tracker protocol support" -- fix trivial r12141 log message typo: s/Unsupported ur/Unsupported url/ 2011-03-20 15:33:45 +00:00
Jordan Lee 3b9142f75e (trunk libT) #117 "UDP tracker protocol support" -- (1) fix connection attempt retries after a failed connection attempt. (2) extract method from tau_tracker_upkeep() for clarity: tau_tracker_send_reqs() and tau_tracker_timeout_reqs()
refactor the timeout/request code a bit.
2011-03-20 15:28:41 +00:00
Jordan Lee f996c4fbb9 (trunk libT) #4114 "crash on open r12168 in tau_sendto()" -- fixed. 2011-03-18 17:11:42 +00:00
Jordan Lee 6ae220dee0 (trunk libT) tr_udpParse(): default to port 80 for URLs with a udp scheme and no explicit port. 2011-03-17 21:22:58 +00:00
Jordan Lee f4b4ddd231 (trunk libT) better shutdown management of libutp and UDP trackers in tr_sessionClose().
This is a little overlapping since the utp code can be closed more-or-less immediately, but the udp manager needs to stay open in order to process the udp tracker connection requests before sending out event=stopped. Moreover DNS resolver can be shut down after the UDP tracker is shutdown.
2011-03-17 18:51:31 +00:00
Jordan Lee 78a4865aa1 (trunk libT) as a followup to r12182, move LPD's periodic upkeep timer into the tr-lpd.c module where it can be started & stopped with the pre-existing tr_lpdInit() and tr_lpdUninit() functions. 2011-03-17 13:16:23 +00:00
Jordan Lee 501f2e106f (trunk libT) move tr_lpdAnnounceMore() out of the announcer module
We can stop local peer discovery immediately during shutdown, but need to leave the announcer running for the event=stopped messages. So it doesn't make sense to keep them on the same periodic timer.
2011-03-17 12:45:29 +00:00
Jordan Lee 6835374661 (trunk libT) move tr_dhtUpkeep() out of the announcer module
During shutdown, we can stop DHT almost immediately, but need to leave the announcer running for the DHT tracker event=stopped messages. So it doesn't make sense to keep them on the same periodic timer.
2011-03-17 12:34:43 +00:00
Jordan Lee 686103ae49 (trunk libT) #117 "UDP tracker protocol suppoort" -- in case the tracker gives an error message in response to a connection response, store the error message in the scrape/announce response structs' errmsg fields. 2011-03-17 04:16:19 +00:00
Jordan Lee 13514e16a7 (trunk libT) #4127 "Torrent complete script doesn't pass on the environment" -- fixed with patch from geirha.
The fix was to putenv() the new environment variables, then call execvp() instead of execve().
2011-03-16 18:11:48 +00:00
Jordan Lee 374ed10f3b (trunk) it's bad form to #include so many system headers in libtransmission/utils.h... 2011-03-16 18:04:23 +00:00
Jordan Lee 30f8f499ed (trunk libT) move the single-use utility function "evbuffer_ref_cleanup_tr_free()" from a public header into a private function to limit its visibility/scope 2011-03-16 17:42:32 +00:00
Jordan Lee 29af00ef56 (trunk libT) make readOrWriteBytes() more readable 2011-03-16 04:44:38 +00:00
Jordan Lee 4844555f26 (trunk libT) remove the "a file disappeared!" check from readOrWriteFile().
In both the reading and writing case, this is handled with human-readable errors further up the call chain.
2011-03-16 03:19:56 +00:00
Jordan Lee 7f1a419dd1 (trunk libT) remove unused code from inout.c 2011-03-16 03:17:26 +00:00
Jordan Lee 330e922cc7 (trunk libT) minor tweak to the cache sorting code 2011-03-16 00:49:43 +00:00
Jordan Lee 757dac11ef (trunk libT) cpu load improvements based on profiling by gunzip 2011-03-15 18:11:31 +00:00
Jordan Lee 591b95286f Show whether a tracker is http or udp. Without that context, it could be confusing to see the same tracker twice in a tier 2011-03-15 17:03:09 +00:00
Jordan Lee fee784f1d8 (trunk) #4081 "Add 'cookieString' argument 'torrent-add' method in RPC" -- done. 2011-03-15 04:22:47 +00:00
Jordan Lee 15e2e7d491 (trunk libT) annnouncer.c: as discussed with Waldorf, massage the tracker lists a bit:
1. remove duplicate URLs caused by implicit vs. explicit port numbers
2. if two announce URLs are duplicates /except/ for their scheme, put them in the same tier.
3. try announce URLs with a "udp" scheme before trying ones with an "http" scheme.
2011-03-15 03:21:25 +00:00
Jordan Lee 297c24a8a0 (trunk libT) more announce.c work: better handling of incrementing the retry interval on scrape failures 2011-03-14 16:52:47 +00:00
Jordan Lee cc55286261 (trunk libT) #117 "UDP tracker protocol support (BEP #15)": (1) use the UDP tracker error response's error string (2) better handling of requests that timeout (3) better filtering of non-tracker UDP messages 2011-03-14 14:15:58 +00:00
Jordan Lee 6b682f8042 (trunk libT) make tr_ptrArrayNth() an inline function 2011-03-14 14:09:41 +00:00
Jordan Lee 46b85c7994 (trunk libT) more tweakin' 2011-03-14 02:40:39 +00:00
Jordan Lee 11e0883ee4 (trunk libT) fix array-bounds-read in the UDP tracker code when an announce or scrape request times out 2011-03-14 02:39:11 +00:00
Jordan Lee 4fc6c1ada2 (trunk libT) add attribution for the fallback tr_htonll() and tr_ntohll() code 2011-03-13 20:39:08 +00:00
Jordan Lee 58c084fbda (trunk libT) better implementation of tr_htonll() and tr_ntohll() 2011-03-13 20:23:23 +00:00
Jordan Lee cdff3aa090 (trunk libT) minor tweak: use evutil_closesocket() instead of the older EVUTIL_CLOSESOCKET() macro. 2011-03-13 19:47:21 +00:00
Jordan Lee e3fab720d1 (trunk) make sure all files with $Id$ has svn:properties set 2011-03-13 14:38:49 +00:00
Jordan Lee dc8e97eb43 (trunk libT) tweak #includes in announcer-http.c 2011-03-13 14:33:28 +00:00
Jordan Lee 4f6d031a9f (trunk libT) fix tau_send crash reported by Waldorf overnight in #4114 2011-03-13 14:18:35 +00:00
Jordan Lee 075a0a8b86 (trunk libT) use libevent's portability wrapper for strcasecmp() 2011-03-13 08:21:55 +00:00
Jordan Lee 4a4842fea5 (trunk libT) use libevent2's portability wrappers for inet_ntop() and inet_pton().
We currently implement our own versions of these on mingw because that platform doesn't have them... but why reinvent the wheel; libevent has already done the same thing. Let's use libevent2's implementation.
has already done it for us.
2011-03-13 08:15:40 +00:00
Jordan Lee 2cca699f06 (trunk libT) #117 "UDP tracker support (BEP #15)" -- added request timeout
UDP announce and scrapes now have a 120 second TTL.
2011-03-13 06:38:54 +00:00
Jordan Lee 7a24257d00 (trunk libT) tweaks by werehamster 2011-03-13 05:45:34 +00:00
Jordan Lee 5ad95ee3d5 (trunk libT) fix minor memory leak reported by rpc-server.c 2011-03-13 00:35:11 +00:00
Jordan Lee 3cfef5eded (trunk libT) #117 "UDP tracker protocol support" -- working implementation; needs testing and valgrinding and review. 2011-03-13 00:18:11 +00:00
Jordan Lee 76fdae97cb (trunk libT) #4106 "Assert in buildHandshakeMessage, r12131" -- probable fix 2011-03-11 19:28:44 +00:00
Jordan Lee 77a0a0b619 remove unused field 2011-03-11 17:26:41 +00:00
Jordan Lee 99ab56a82f (trunk libT) copyediting: removing trailing spaces from lines 2011-03-11 15:44:24 +00:00
Jordan Lee 7d551f609c (trunk libT) implement multiscrape. 2011-03-11 15:11:37 +00:00
Jordan Lee d1f3a885a5 (trunk libT) ensure that a tr_torrent's peer id is initialized when the tr_torrent is constructed 2011-03-11 15:00:10 +00:00
Jordan Lee a3cfc11268 (trunk libT) repeat the r12129 fix for delegating https scrapes 2011-03-11 13:04:09 +00:00
Jordan Lee 9704888172 (trunk libT) fix r12127 bug with delegating https trackers 2011-03-11 05:48:57 +00:00
Jordan Lee ef5bb89e91 (trunk libT) optimization for ocelot.
When seeding on a private tracker, ocelot omits other seeds from the list of peers returned. We can test for this and update our "seed probability" field accordingly.
2011-03-11 04:57:53 +00:00
Jordan Lee b46d3a2713 (trunk libT) #117 "UDP tracker protocol support (BEP #15)" -- refactor announcer.c so that alternate tracker protocols can be supported.
This commit adds a set of package-visible structs and functions to allow delegating announces and scrapes to different protocol handlers. (Examples: struct tr_announce_request, struct tr_announce_response, struct tr_scrape_request, struct tr_scrape_response.) HTTP is the only protocol handler currently implemented; however, this provides a clean API for other protocol handlers, and having this in trunk will help shake out any bugs in this refactoring.

In addition, logging via the TR_DEBUG_FD environment variable is vastly improved in the announcer module now.
2011-03-11 04:19:01 +00:00
Jordan Lee 896c9b54e1 (trunk libT) Add an enumeration for the peer id length. Use that enum for the peer_id fields in tr_session and tr_torrent.
This also avoids an extra malloc/free per-torrent and per-session, but mostly this tweak is for the extra readability of the PEER_ID_LEN=20 enum.
2011-03-10 12:35:23 +00:00
Jordan Lee b38466323b (trunk libT) use a hex key for tracker announces. 2011-03-10 11:46:22 +00:00
Jordan Lee 3933d84e1c (trunk libT) #4084 "after reaching seed state, no new peers are acquired" -- possible fix.
This revises r12110 based on feedback from sadface about the use of tr_atom.uploadOnly.
2011-03-07 14:59:47 +00:00
Jordan Lee b4538e0625 (trunk libT) copyediting.
1. make some accidentally-public functions/variables private 
2. comment out tr_generateAllowedSet() since we're not using it
3. argument list indentation
2011-03-07 14:33:45 +00:00
Jordan Lee d2270852af (trunk libT) simpler implementation of the idea behind the code removed in r12108 and r12109. 2011-03-07 04:48:46 +00:00
Jordan Lee 6b4d500c36 (trunk libT) finish r12108 2011-03-07 03:46:26 +00:00
Jordan Lee c9897ff97a experimental fix for #4084 2011-03-06 23:49:40 +00:00
Jordan Lee 9e07e19b05 (trunk libT) #4085 "transmission crashed when adding a new torrent: assert failed" -- possible fix? 2011-03-05 16:29:19 +00:00
Jordan Lee 7ad41603e9 (trunk libT) #2338: "uTP support" -- enable uTP by default. 2011-03-05 16:19:56 +00:00
Jordan Lee f015bafdbf (trunk libT) #4083 "Wrong shades of progress in Inspector pieces view." -- fixed.
The problem was reported by Rolcol and tracked down by livings124. It's flashing orange because the completion in "availability" doesn't match the completion in in "progress", which corresponds with tr_torrentAvailability() and tr_torrentAmountFinished(). tr_cpGetAmountDone() was recently reworked in r12012 for #4048, which caused the problem. Both functions need to sample the torrent using the same methodology so that their results can be used together.
2011-03-05 03:51:57 +00:00
Jordan Lee 9bf2434e14 (trunk) copyediting: remove trailing spaces from source code lines in daemon/ gtk/ libtransmission/ and utils/ 2011-03-04 23:26:10 +00:00
Jordan Lee 918f6a96e0 (trunk libT) fix possible memory leak in tr-udp's EV_READ handler.
The EV_READ callback allocates a buffer, but then returns without freeing it if recvfrom() returns <= 0. This commit inverts the logic to avoid returning until the buffer's been free()d.
2011-03-04 21:38:04 +00:00
Jordan Lee 3fdd80eb0d (trunk libT) new function: tr_ssToAddr()
This handles converting the data in a sockaddr_storage to a tr_address + port, and removes redundant code from fdlimit.c and tr-udp.c that previously did this work.
2011-03-04 21:00:52 +00:00
Jordan Lee 9024cb29f9 (trunk libT) #3208 "Local Peer Discovery idea: prioritize LPD requests for downloads" -- add patch from Eszet 2011-03-04 17:33:29 +00:00
Jordan Lee b10aea6fcc (trunk) #4072 "remove the 'know peer count' field in Inspector" -- remove it from libtransmission too 2011-03-04 04:50:50 +00:00
Jordan Lee a1b81cd152 (trunk libT) fix peerDestruct() crash when peer doesn't have a corresponding atom 2011-03-04 04:45:12 +00:00
Jordan Lee 020bde5ce6 (trunk libT) a bit of futzing: remove a few more unnecessary casts from void* 2011-03-03 21:51:11 +00:00
Jordan Lee 0cf05fdffd (trunk libT) add an "existing dir" argument to tr_fdFileCheckout().
existing_dir: An ancestor of filename which must already exist and won't be created by tr_fdFileCheckout(). In implementation this is the download directory and prevents directories from being created in error, such as a mount point for an external drive when the drive is unplugged.
2011-03-03 19:59:12 +00:00
Jordan Lee c6f52ecb11 remove a handful of unnecessary casts 2011-03-03 19:56:44 +00:00
Jordan Lee 0c36e0c9de (trunk libT) remove the unused tr_ratecontrol code. switch webseed over to using tr_bandwidth. 2011-03-03 18:33:24 +00:00
Jordan Lee 6d94a33f2d (trunk libT) #4070 "assertion failure happens soon after startup" -- fixed.
Thanks to User294 for helping to track down the problem.
2011-03-03 17:28:04 +00:00
Jordan Lee f9c6deab6f (trunk libT) minor revision to r12065: clamp the bandwidth before applying the ratio calculation 2011-03-03 07:20:18 +00:00
Jordan Lee ab3cc08258 (trunk libT) #4078 "Better calculation of the bitfield length while still a magnet link" -- fixed. 2011-03-02 15:00:12 +00:00
Jordan Lee 6e84fb89fa (trunk libT) work in progress, but this is a slightly better speed limiting for mixed tcp/utp peers 2011-03-02 07:21:58 +00:00
Jordan Lee 0e27f583d3 (trunk libT) #4047 "transfer speed shown as 0" -- revert r11783 (#3950) because it caused speed misreporting. 2011-03-01 15:23:13 +00:00
Jordan Lee aa89303254 (trunk libT) #4073 "suggest inclusion of <signal.h> in torrent.c" -- done. 2011-02-28 13:10:56 +00:00
Mitchell Livingston 73956c6a4f store secondsDownloading and secondsSeeding as ints instead of time_t 2011-02-26 15:01:07 +00:00
Mitchell Livingston 6092362c1e revert the last commit 2011-02-26 14:59:05 +00:00
Mitchell Livingston 39709abd6e store secondsDownloading and secondsSeeding as ints instead of time_t 2011-02-26 14:56:58 +00:00
Jordan Lee cff172bbd5 (trunk libT) peer-mgr.c peerCallbackFunc(): Replace some "should always be true" tests with assert()s. These tests used to be useful, but I don't think they are anymore. The assert()s have been put in their place to test that theory... 2011-02-25 01:48:46 +00:00
Jordan Lee 9d95bd151d (trunk libT) #4035 "In seed state, transmission disconnect from leechers" -- fixed. 2011-02-24 14:35:45 +00:00
Jordan Lee 6dc20636bb (trunk libT) utils-test.c: remove some debugging stubs that should not have been checked in 2011-02-24 04:16:47 +00:00
Jordan Lee 25366156b1 (trunk libT) make the tr_bitsetToBenc() and tr_bitsetFromBenc() functions follow bitset.c's variable naming convention of how the "this" pointer is named 2011-02-24 04:14:12 +00:00
Jordan Lee f4992d885c (trunk libT) if we're a partial seed and the peer has everything we have, disconnect. 2011-02-24 01:50:35 +00:00
Jordan Lee 0c6c569b69 (trunk libT) minor cleanup: improve the function names torrentConstructor() and torrentDestructor().
These functions actually allocate/free the memory where these objects reside, so it's clearer to name them torrentNew() and torrentDelete().
2011-02-23 06:18:09 +00:00
Jordan Lee bf8e4594e0 (trunk libT) minor cleanup: improve the function names peerConstructor() and peerDestructor().
These functions actually allocate/free the memory where these peer objects reside, so it's clearer to name them peerNew() and peerDelete().
2011-02-23 06:14:06 +00:00
Jordan Lee f2b4a59eda (trunk libT) #4051 "Use composition for the tr_history fields in tr_peer" -- fixed.
If we use composition on these objects we can save a handful of pointers per peer. This isn't a big deal, but it's an easy/safe change to do.
2011-02-23 06:01:16 +00:00
Jordan Lee 2b9db3c242 (trunk libT) #4048 "use bitsets instead of bitfield in tr_completion" -- done.
Excuse the sprawl. Much of this didn't fit into self-contained commits.
2011-02-23 03:54:04 +00:00
Jordan Lee 094b726316 (trunk libT) remove unused code: tr_bitfieldIsEmpty() 2011-02-21 15:43:41 +00:00
Jordan Lee 32237dbdb0 (trunk libT) remove unused functions: tr_bitsetDifference() tr_bitfieldDifference() 2011-02-21 15:36:07 +00:00
Jordan Lee 6ab918a202 (trunk libT) code cleanup: moving bitset functions to their own .c file. 2011-02-21 01:40:19 +00:00
Jordan Lee 25ad6bbad2 (trunk libT) remove dead code in peer-common.h: the tr_addreq_t enum 2011-02-21 01:15:13 +00:00
Jordan Lee 1ccdb1a797 (trunk libT) web.c: free the unprocessed tasks before exiting the libcurl thread.
This is rare but can happen during shutdown if there are unresponsive trackers. Cleaning up the tasks improves the S/N ratio in valgrind a bit.
2011-02-21 01:13:28 +00:00
Jordan Lee e77a627d3c (trunk libT) mark the two "progress" args to tr_torrentSetLocation() as volatile. 2011-02-19 20:10:05 +00:00
Jordan Lee 05ff024dd8 (trunk libT) #3372 "What happened with closing idle peers?" -- fixed. 2011-02-19 12:32:41 +00:00
Jordan Lee 7a8ab0ddbe (trunk libT) closeBadPeers() part 2 of 2: this function was serving two purposes, which wasn't clear from its name. refactor slightly to make the purpose and name match. 2011-02-19 12:30:18 +00:00
Jordan Lee 1592953439 (trunk libT) closeBadPeers() part 1 of 2: don't bother sorting these peers by activity -- we're closing -all- of them, so sorting them is pointless. 2011-02-19 12:24:00 +00:00
Juliusz Chroboczek 352981ee03 Remove obsolete UNUSED marker. 2011-02-18 21:55:42 +00:00
Jordan Lee e2584b04ff (trunk libT) #4047 "timeChecked for the last piece is not saved to a resume file" -- fixed.
A garden variety off-by-one error. good patch by jusid and revision by me.
2011-02-18 19:31:18 +00:00
Juliusz Chroboczek e7fc697c90 Stub out UTP_Create in non-uTP builds. 2011-02-18 16:01:52 +00:00
Jordan Lee 80d06d4c34 (trunk libT) add a bool to tr_peer_stat and the RPC peer list to denote whether or not a peer's connected via µTP 2011-02-18 04:07:43 +00:00
Jordan Lee b930026c40 (trunk libT) explicitly use the libevent2 header files, instead of the deprecated backwards-compatibility one 2011-02-18 01:25:32 +00:00
Jordan Lee cba90ccace (trunk libT) add stubs for UTP_Drained() and UTP_Write() to remove a few #ifdefs from peer-io.c 2011-02-18 01:18:51 +00:00
Jordan Lee 8e87147c61 (trunk libT) add a stub for UTP_Close() s.t. peer-mgr.c doesn't need the #ifdefs from r11960 2011-02-18 01:06:42 +00:00
Jordan Lee cd04051de8 add configure script switch to enable/disable utp 2011-02-18 00:45:44 +00:00
Juliusz Chroboczek 40463b9d0a Reinstate a variable removed by r11810. 2011-02-18 00:43:54 +00:00
Juliusz Chroboczek 828c9888b0 Don't attempt uTP connexions to peers learned from PEX that didn't signal support. 2011-02-18 00:43:49 +00:00
Juliusz Chroboczek 5af8e26251 Use large kernel buffers for the UDP socket when uTP is enabled.
Since we're using a single UDP socket to implement multiple uTP sockets,
and since we're not always timely in servicing an incoming UDP packet,
it's important to use a large receive buffer.  The send buffer is probably
less critical, we increase it nonetheless.
2011-02-18 00:43:47 +00:00
Juliusz Chroboczek a348c5d421 Don't call tr_utpClose in toggle_utp.
The uTP timer needs to run even when uTP has been disabled, or else the
uTP sockets will never time out.
2011-02-18 00:43:45 +00:00
Juliusz Chroboczek 2729d3c291 Don't mark atoms as non-uTP unless we failed to connect. 2011-02-18 00:43:43 +00:00
Juliusz Chroboczek 55b050f18e Clear utp_failed flag upon seeing an announcement for ut_holepunch. 2011-02-18 00:43:39 +00:00
Juliusz Chroboczek 07addc7d0d Try uTP connections by default. 2011-02-18 00:43:37 +00:00
Juliusz Chroboczek 2ba3305412 When failing to connect over uTP, fall back to TCP. 2011-02-18 00:43:34 +00:00
Juliusz Chroboczek 704f984bdf Implement atom->utp_failed and peerMgrSetUpFailed. 2011-02-18 00:43:31 +00:00
Juliusz Chroboczek 5ba2e40f79 When uTP is disabled, don't call UTP_CheckTimeouts too often. 2011-02-18 00:43:27 +00:00
Juliusz Chroboczek 25b8d08537 When uTP is enabled, open uTP connections to some peers.
Since we don't implement falling back to TCP yet, we're very
conservative: we only use uTP when we have good reasons to believe
the peer speaks uTP.
2011-02-18 00:43:24 +00:00
Juliusz Chroboczek cc96b12bbc Fix typo. 2011-02-18 00:43:21 +00:00
Jordan Lee 004d30337b when sending PEX messages, unset the holepunch flag because we don't support holepunch. 2011-02-18 00:41:32 +00:00
Jordan Lee f00799f80c if we successfully finish a handshake using uTP, mark the peer as supporting uTP 2011-02-18 00:41:06 +00:00
Jordan Lee 75badcd4ab silence compiler warning 2011-02-18 00:40:53 +00:00
Jordan Lee 71486f8c86 call UTP_RBDrained when our read buffer is empty 2011-02-18 00:40:38 +00:00
Jordan Lee e4b4812caa add dbgmsg statements to peer-io's uTP code 2011-02-18 00:40:22 +00:00
Jordan Lee 9626aa4506 uTP peers need tr_peerIoFlush() to work during the handshake phase. 2011-02-18 00:40:01 +00:00
Jordan Lee f6a85cb16b implement bandwidth limiting for uploads to uTP peers 2011-02-18 00:39:33 +00:00
Juliusz Chroboczek 3c56dbea2a Remove more debugging messages. 2011-02-18 00:36:36 +00:00
Juliusz Chroboczek f33a772b00 Call didWriteWrapper in utp_on_write. 2011-02-18 00:36:33 +00:00
Juliusz Chroboczek e35d1aacaf Don't propagate information about ut_holepunch over PEX.
It's not useful, says Greg.
2011-02-18 00:36:31 +00:00
Juliusz Chroboczek c9c2ad7c57 Don't use read_enabled in get_rb_size.
We're no longer maintaining read_enabled, as there are simpler ways of
doing the same.  Additionally, we used RBDrained incorrectly.
2011-02-18 00:36:27 +00:00
Juliusz Chroboczek 77c034122e Revert "Maintain information about enabled/disabled I/O."
This reverts commit 604f8fd10db747e57d8710cc53326c0e114ad32c.
2011-02-18 00:36:24 +00:00
Juliusz Chroboczek c9a7becf87 Remove debugging messages. 2011-02-18 00:36:21 +00:00
Juliusz Chroboczek 88f4eac81f Implement outgoing uTP connections. 2011-02-18 00:36:19 +00:00
Juliusz Chroboczek 456dbdd935 Export uTP send_to callback. 2011-02-18 00:36:16 +00:00
Juliusz Chroboczek 11114a74c0 Fix peerIoReconnect for uTP sockets. 2011-02-18 00:36:12 +00:00
Juliusz Chroboczek dae7db8e10 Implement pacing of reads.
This should cause uTP sockets to respect read bandwidth limits.  I'm not so
sure about the values we return for the read buffer size -- perhaps we
should allow some slack for network latency?
2011-02-18 00:36:09 +00:00
Juliusz Chroboczek d347f5ada4 Maintain information about enabled/disabled I/O. 2011-02-18 00:36:07 +00:00
Juliusz Chroboczek 236fb3d9d6 Set the read buffer of UTP sockets to a well-defined value. 2011-02-18 00:36:05 +00:00
Juliusz Chroboczek 80677b3730 Compute accurate overhead for uTP packets. 2011-02-18 00:36:02 +00:00
Juliusz Chroboczek 51bc8d8b80 Push testig for UTP enabled further down.
There's no need to test for DHT/uTP being enabled in tr-udp.  The DHT
will silently discard any packets directed at the wrong session (see the
beginning of dhtCallback).  As to uTP, we need to grok uTP packets
to close any remaining connections after we disabled uTP, so it's better
to participate in uTP, just reject any incoming connections.
2011-02-18 00:35:56 +00:00
Juliusz Chroboczek 4f50c5dda4 Fix typo. 2011-02-18 00:35:54 +00:00
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