Jordan Lee [Wed, 27 Apr 2011 20:52:07 +0000 (20:52 +0000)]
(trunk libT) heap pruning: using the same mechanism as in r12388, avoid an unnecessary malloc+memcpy+free when building the URL for a webseed download request
Jordan Lee [Wed, 27 Apr 2011 20:50:43 +0000 (20:50 +0000)]
(trunk libT) heap pruning: using the same mechanism as in r12388, avoid an unnecessary malloc+memcpy+free when TR_CURL_VERBOSE is logging HTTP messages
Jordan Lee [Wed, 27 Apr 2011 20:41:47 +0000 (20:41 +0000)]
(trunk libT) heap pruning: avoid unnecessary malloc+memcpy+frees in announcer.
1. when creating announce URLs in announcer-http.c
2. when creating scrape URLs in announcer-http.c
3. when deep-logging what announces are in a torrent's queue in announcer.c
Jordan Lee [Wed, 27 Apr 2011 05:29:05 +0000 (05:29 +0000)]
(trunk libT) #4209 "Shortcut UDP tracker test" -- prioritize the UDP handler functions based on frequency (uTP, DHT, UTP tracker) as outlined by jch in comment:5. Also, don't call the uTP or DHT handlers when uTP or DHT is disabled in the system preferences.
To avoid the function call overhead described by jch, instead of calling tr_sessionIsUTPEnabled() and tr_sessionIsDHTEnabled(), we test for WITH_UTP to be defined and test the tr_session.isUTPEnabled and tr_session.isDHTEnabled flags directly.
Jordan Lee [Wed, 27 Apr 2011 05:03:10 +0000 (05:03 +0000)]
(trunk libT) #4209 "Shortcut UDP tracker test" -- the goal of #4209 is to minimize the cost of the UDP event callback function, so apply the heap pruning eye to that by removing an unnecessary malloc/free call there.
Previously we allocated a 4096 character buffer each time; now we allocate it on the stack. It seems all the distros and OS flavors that Transmission runs on have multi-MB default stack sizes, so a hardwired 4K array should be safe.
Jordan Lee [Tue, 19 Apr 2011 19:22:55 +0000 (19:22 +0000)]
(trunk) revert r12372 based on feedback from er13: "Many embedded systems use uClibc++ (and not the gcc' libstdc++) as an implementation of Standard C++ Library. r12372 breaks the compilation of transmission for such systems."
Jordan Lee [Tue, 19 Apr 2011 15:23:04 +0000 (15:23 +0000)]
(trunk libt) #4164 "__FD_SETSIZE impact on open-file-limit and peer-limit-global" -- commit patch by romanr to take FD_SETSIZE into account before calling setrlimit()
Jordan Lee [Tue, 19 Apr 2011 14:40:46 +0000 (14:40 +0000)]
(trunk) fix "__gxx_personality_v0" when compiling Transmission on some versions of gcc/g++
The problem is coming from gcc getting confused by having a C program (Transmission) link against a C++ library (libutp). In gcc, C++ code has an implicit dependency on libstdc++ for the __gxx_personality_v0 function.
More info @ http://stackoverflow.com/questions/329059/what-is-gxx-personality-v0-for
Jordan Lee [Sun, 17 Apr 2011 05:55:46 +0000 (05:55 +0000)]
(trunk libT) heap and event pruning: don't create evtimers for periodic pex messages if the torrent doesn't allow pex (such as, if it's on a private tracker).
Previously, we unconditionally created the evtimer, and then checked each time to see if pex was allowed.
Jordan Lee [Sat, 16 Apr 2011 22:33:29 +0000 (22:33 +0000)]
(trunk libT) #4165 "__FD_SETSIZE impact on open-file-limit and peer-limit-global" -- add safety guard in the file cache to prevent too many open files.
Instead of calling gtk_combo_box_get_active_iter() on the filterbar's two comboboxes in every periodic update, keep the state information in a local struct and update it when the selection changes. That way the filter code doesn't even need to know about the GtkComboBox or the GtkTreeModel.
Jordan Lee [Wed, 13 Apr 2011 22:00:55 +0000 (22:00 +0000)]
(trunk gtk) more heap pruning: minor GtkTreeModel changes
Use gtk_tree_model_iter_nth_child() instead of gtk_tree_model_get_iter_first() to avoid an unnecessary gtk_tree_path object being created and destroyed. This is a very minor change and I'm not sure how useful it really is, but it doesn't hurt.
Jordan Lee [Wed, 13 Apr 2011 06:18:30 +0000 (06:18 +0000)]
(trunk gtk) more heap pruning:
querying gconf2 each time the curl callack function is called is expensive, so query it once -- then again later, if the proxy settings change -- and remember the values in a local struct.
Jordan Lee [Mon, 11 Apr 2011 19:44:16 +0000 (19:44 +0000)]
(trunk libT) fix 2.30b1 memory corruption bug when editing trackers.
The problem was that the new number of trackers was not being kept and the old count was retained. So if the count changed, tr_torrentTrackers() could return dangling pointers to the caller.
Jordan Lee [Thu, 7 Apr 2011 20:00:26 +0000 (20:00 +0000)]
(trunk libT) use get_next_scrape_time() inside the scrape error handler.
get_next_scrape_time() was introduced in r12297. The rationale is that by rounding all scrape times to their nearest 10th second, they will tend to occur in batches and improve multiscrape.
Jordan Lee [Thu, 7 Apr 2011 19:54:30 +0000 (19:54 +0000)]
(trunk libT) #3931 "'Announce is Queued' but torrent doesn't announce itself to trackers" -- add more debugging information for the next announce interval when an announce error is encountered, as requested by Sardok in comment:70 of #3931
Jordan Lee [Wed, 6 Apr 2011 23:27:11 +0000 (23:27 +0000)]
(trunk libT) more heap pruning: avoid four unnecessary malloc() + free() calls per tr_peer.
This commit also changes tr_recentHistory from being a general-purpose tool to being a little more hardcoded for the only purpose it's used, in tr_peerMgr. If its files (history.[ch]) don't find any other "customers" in libtransmission, eventually it should be demoted to being a private helper class inside of peer-mgr.c and have the history.[ch] files removed from the build.
Jordan Lee [Tue, 5 Apr 2011 16:46:13 +0000 (16:46 +0000)]
(trunk libT) when processing errors in peer-io.c's event_read_cb() and tr_peerIoTryRead() functions, don't call tr_net_strerror() unless logging is turned on s.t. the string will be used.
Jordan Lee [Tue, 5 Apr 2011 15:41:51 +0000 (15:41 +0000)]
(trunk gtk) more heap pruning: in the main window's torrent list, only update the case-insensitive "collated name" of a torrent when the torrent's metadata changes (such as when a magnet link's metadata finishes downloading).
Jordan Lee [Mon, 4 Apr 2011 05:15:54 +0000 (05:15 +0000)]
(trunk libT) avoid an unnecessary malloc() + free() call when we finish downloading a block.
Pre-libevent2, this free() was useful in helping keep the peer's incoming piece data buffer from growing too large because that could be a significant amount of wasted space given enough peers. However now that we're using the libevent2 code, that piece data buffer gets handed off to the block cache, so most of the time we're freeing an evbuffer that doesn't have any inernal chains allocated anyway.