Commit Graph

3916 Commits

Author SHA1 Message Date
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
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
Jordan Lee f2f08f5469 (trunk libT) more NULL ptr safeguards 2011-01-27 18:54:25 +00:00
Jordan Lee 35515ee424 (trunk libT) NULL ptr safeguard 2011-01-27 05:00:09 +00:00
Jordan Lee 5d15ee8439 (trunk) #3949 "Add --enable-lightweight argument to configure" -- fixed.
TR_EMBEDDED has been around for awhile, but few (any?) repackagers are aware of it. If it was "advertised" through a configure-time argument, and in the status messages at the end of the configure script, more repackagers would be aware of it.
2011-01-27 03:53:02 +00:00
Jordan Lee 125d2506cd (trunk libT) torrent.c setLocation(): don't try to move a file if the source and destination paths are the same. 2011-01-24 06:07:06 +00:00
Jordan Lee 4e38d97621 (trunk libT) #2955 "verify pieces only when necessary, or when the user requests it." -- add better support for old .resume files
Super-poussin says some readynas users are reporting high CPU oloads in 2.20 beta 1. My guess is this is due to pieces being reverified. Before now, the .resume files kept timestamps per-file, and 2.20 keeps timestamps per-piece. The problem is that 2.20 beta 1 didn't support reading the older per-file timetstamps from .resume files, so users loading up 2.20 beta 1 may find Transmission thinks none of the pieces in the torrents have been verified.

The fix is to have 2.20 beta 2 read the old per-file timestamps, so upgrading from 2.1x to 2.20 will go smoothly. That's what this commit does.

Unfortunately, the readynas users who have already been bitten by this will continue to be bitten until they reverify their files. 2.20 beta 1, which thinks all those pieces were never verified, has probably overwritten the .resume files from 2.1x... :(
2011-01-24 05:11:16 +00:00
Mitchell Livingston a1eedd117d #3940 Global displayed speed does not include webseeds; remove a now-unused libT speed function 2011-01-23 18:23:52 +00:00
Jordan Lee 0aee598300 (trunk libT) #3937 "inactive webseeds are listed as active"
This is caused by libtransmission using tr_webseedIsActive() in two ways: (1) webseed.c uses it to know if there are any pending requests, and (2) tr_torrentStat() uses it to set tr_stat.webseedsSendingToUs. Having a queued task isn't enough to be "active" in use (2) -- it needs to know if the webseed is actually sending data. These two uses should be moved into separate functions.
2011-01-23 16:35:23 +00:00
Jordan Lee 599d33035b (trunk libT) #3906 "DHT ignores bind-address-ipv6" -- make the process of getting the binding address consistent between IPv4 and IPv6 sockets.
As suggested by Juiusz after the IPv6 binding commit in r11749.  See: https://trac.transmissionbt.com/ticket/3906#comment:6
2011-01-22 20:43:36 +00:00
Jordan Lee f36fc1246c (trunk libT) #3934 "manual reannounce doesn't work if the initial announce failed" -- fixed.
Use tor->isRunning, rather than tier->isRunning, when testing to see if a torrent can manual announce or not.  tor->isRunning means we're inbetween the user pressing "start" and "stop." tier->isRunning means we're inbetween successful "started" and "stopped" announcements. (This is deliberately out-of-sync from tor->isRunning because it can take awhile to for tracker announces to finish.)

Under the old code (using tier->isRunning), it was impossible to manually reannounce unless there had been a successful event=started announce first. It was also possible to manually announce after the "stop" button had been pressed if the "event=stopped" announcement hadn't finished yet.
2011-01-22 19:56:01 +00:00
Jordan Lee 75ffe999d4 (trunk libT) #3933 "announcer.c peer parsing could be simpler" -- fixed.
Remove redundant code by using tr_peerMgrCompactToPex() and tr_peerMgrCompact6ToPex() to parse compact ipv4 and ipv6 peer lists. Simplify the old-style benc peer list parsing and fix a bug that returned too few bytes in the old-style peer array.
2011-01-22 17:45:54 +00:00
Jordan Lee 68130d9c4e (trunk libT) #3906 "DHT ignores bind-address-ipv6" -- test fix.
Add code to honor the ipv6 bind address. Thanks to jch for saving me a little work by confirming the bug and pointing out where in the code the change needed to be made.
2011-01-22 13:49:15 +00:00
Jordan Lee 53f7fbb039 (trunk libT) #3927 "Use of libevent2 evbuffer_write on files..."
evbuffer_write() is intended for sockets. It works for files on Unix, but not on Windows, so we can't portably use it on files. Instead, use evbuffer_pullup() + write().
2011-01-22 13:33:05 +00:00
Jordan Lee 9220ad2300 (trunk libT) #3932 "Assertion failed: (tab != NULL), function tr_torrentAvailability"
Looks like tab can be NULL from the Mac client when magnet links are involved and the Mac client doesn't know how many pieces are available, so that assertion's not appropriate.
2011-01-22 13:21:20 +00:00
Jordan Lee 5b382d203e (trunk libT) #3870 "transmission doesn't recheck after getting initial 404" -- fixed.
The exponentially-growing interval between retries had a bug that caused intervals to be too long if no successful announce had ever been made. This commit fixes the code that calculates the interval.
2011-01-20 22:51:05 +00:00
Jordan Lee bca543dc8e (trunk libT) #3923 "remove redundant announcer.c debug message" -- done. 2011-01-20 20:49:09 +00:00
Jordan Lee bcb83b4577 (trunk libT) #3921 "no overhead for reads" -- fixed. thanks to jch for reporting this. 2011-01-20 00:31:46 +00:00
Jordan Lee 4f6d46cf99 (trunk libT) minor code tweak to crypto.c's tr_sha1() function 2011-01-19 21:50:51 +00:00
Jordan Lee 6ae426696f tr_sha1(): remove unnecessary casts from va_arg 2011-01-19 21:43:43 +00:00
Jordan Lee 06884387da (trunk) #3914 "strlsize() passes variable of incompatible type to the tr_formatter_size_B()" -- fixed. 2011-01-19 18:14:01 +00:00
Jordan Lee 879a2afcbd Update the copyright year in the source code comments.
The Berne Convention says that the copyright year is moot, so instead of adding another year to each file as in previous years, I've removed the year altogether from the source code comments in libtransmission, gtk, qt, utils, daemon, and cli.

Juliusz's copyright notice in tr-dht and Johannes' copyright notice in tr-lpd have been left alone; it didn't seem appropriate to modify them.
2011-01-19 13:48:47 +00:00
Jordan Lee ba5172150a (trunk libT) #3912 "tr_torrentGetMetadataPercent() may return NaN" -- fixed. 2011-01-19 00:20:26 +00:00
Jordan Lee 8aa0f36a37 cleanup of who calls the libtransmission thread locking functions.
In some cases we were calling them from deep inside libtransmission, when they should have been called directly from the public-visible API functions: tr_torrentWebSpeeds_KBps(), tr_torrentPeers(), tr_torrentTrackers().
2011-01-18 23:44:36 +00:00
Jordan Lee 7ce0cf2322 code cleanup for tr_peerMgrTorrentAvailability().
1. move responsibility for getting a thread lock back to the public API fucntion, tr_torrentAvailability().
2. if the torrent doesn't have metadata, stop after zeroing out the table
3. minor code formatting cleanup
2011-01-18 22:51:29 +00:00
Jordan Lee 7f01f0c3ee #3911: tr_peerMgrTorrentAvailability() doesn't sample across the entire torrent' -- fixed. 2011-01-18 22:21:09 +00:00
Jordan Lee dd77485d83 (trunk libT) demote the remaining lazy-verify debug messages from the debug window to deep logging 2011-01-18 02:17:47 +00:00
Juliusz Chroboczek 5ac1cba6ed Make ensureAtomExists add to the flags of an existing atom.
Flags are cumulative -- if we learn that a given peer groks encryption
from one source, and that it accepts incoming connections from another,
then the relevant atom should have both flags.
2011-01-16 15:51:48 +00:00
Juliusz Chroboczek 96141bdbff Consolidate both versions of tr_isPex into a single function.
There used to be two versions of tr_isPex; one correct in peer-mgr.c,
and one buggy in resume.c.  The buggy version caused us to reject all
peers with non-trivial flags when resuming.
2011-01-16 15:47:09 +00:00
Jordan Lee a433b0c4cc #3686 "add rpc command to cleanly shutdown daemon" -- added for libT, tr-daemon, tr-gtk, tr-remote, and the rpc spec 2011-01-15 18:12:45 +00:00
Juliusz Chroboczek 6f5ecd2ab8 Make the peer-socket-tos preference more user-friendly.
Possible values are now the strings default, lowcost, throughput etc.
Numeric values are used for non-standard values.
2011-01-15 17:10:54 +00:00
Jordan Lee b2d0b673c2 (trunk libT) #2191 "NAT-PMP and UPnP should also map UDP port" -- committed patch by starix. 2011-01-15 17:06:11 +00:00
Juliusz Chroboczek 8ea2c0daa1 Make the peer-congestion-algorithm preference visible.
When I first implemented this code, I made the preference hidden --
unless you set it yourself, it will not appear in the sttings file.
Now that it's been documented and advertised, make it visible.
2011-01-15 16:25:24 +00:00
Jordan Lee 5c96f9ebd8 (trunk libT) fix a minor error in the log message for prefetch errors. thanks to Chinstrap for spotting this. 2011-01-15 05:34:47 +00:00
Jordan Lee 007b96a62f (trunk libT) #3894 "tr_peerIo.hasFinishedConnecting should be removed" -- committed. 2011-01-13 01:58:57 +00:00
Jordan Lee e12788c626 (trunk libT) fix formatting error in a couple of old calls to dbgmsg() 2011-01-12 05:05:48 +00:00
Juliusz Chroboczek 62cb43a173 Don't complain about unexpected DHT packets. 2011-01-09 23:54:54 +00:00