Commit Graph

785 Commits

Author SHA1 Message Date
Mike Gelfand 3b129a72d8 #5908: Check for `tr_loadFile` return value instead of `errno` in `tr_variantFromFile`
Seems like there could be a defect in uClibc making errno not
thread-local. Don't rely on errno value but check function return value
instead which is a better failure indicator.

Return errors from `tr_loadFile` and `tr_variantFromFile` via tr_error.
Fix `tr_sessionLoadSettings` to not fail on Windows if settings.json
does not exist.
2015-04-11 10:51:59 +00:00
Mike Gelfand 45983e66e6 Fix a couple of MinGW warnings. 2015-03-19 06:08:06 +00:00
Mike Gelfand 440f482d01 Replace tabs with spaces; remove trailing spaces 2015-01-02 11:15:31 +00:00
Mike Gelfand 52a9d774e4 Fix compilation on Windows
This should not affect non-Win32 platforms in any way.
As for Win32 (both MinGW and MSVC), this should hopefully allow for
unpatched compilation. Correct functioning is not yet guaranteed though.
2014-12-13 15:22:39 +00:00
Mike Gelfand 4fe156a255 Fix tr_moveFile error reporting
Remove unused `renamed` argument.
Use tr_error instead of errno to report errors to support Win32 file
wrappers which do not map Windows error codes to POSIX ones.
Return bool instead of int (0/-1).

Uncomment tr_error_prefix and tr_error_propagate_prefixed functions.
2014-12-10 18:37:58 +00:00
Mike Gelfand 4cfe7e7ddb #4400, #5462: Move SHA1 helpers to crypto-utils
On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing SHA1 calculation to crypto-utils.{c,h}. OpenSSL-related
functionality (SHA1 context management) is moved to crypto-utils-openssl.c.

Add new tr_sha1_ctx_t type and functions to be implemented by crypto
backends:
* tr_sha1_init - allocate SHA1 context and and initialize it,
* tr_sha1_update - hash some [more] data,
* tr_sha1_final - finish hash calculation and free the context.

Add new files to CMakeLists.txt (leftover from previous commit) to fix
CMake-based configuration.
2014-12-04 12:13:59 +00:00
Mike Gelfand f6f7bf8227 #4400, #5462: Move random helpers to crypto-utils
On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing random numbers/data generation to crypto-utils.{c,h}. OpenSSL-
related functionality (generation of cryptographically strong random
data) is moved to crypto-utils-openssl.c.

Rename functions to follow currently accepted style:
* tr_cryptoRandBuf -> tr_rand_buffer
* tr_cryptoRandInt -> tr_rand_int
* tr_cryptoWeakRandInt -> tr_rand_int_weak

Fix rare case of invalid value being returned from tr_rand_int. Return
value for abs(INT_MIN) may be undefined and thus negative, and so
tr_rand_int will return negative value which is incorrect (out of
requested and expected range).
2014-12-04 11:27:38 +00:00
Mike Gelfand e30728367f #5771: Use true and false instead of 1 and 0 for bool variables (patch by ticamkq + additional fixes) 2014-11-30 19:38:47 +00:00
Jordan Lee ed12ddb090 fix infinite loop in deleteLocalData(). 2014-11-10 01:39:14 +00:00
Jordan Lee d9d66e3e42 (trunk, libt) #4160 - the slow slog to catch trunk up to mike.dld's 4160 diff continues. This step applies 4160-04b-dir.patch, which replaces native file operations with the tr_sys_dir_*() portability wrappers added in the previous commit. 2014-09-21 17:55:39 +00:00
Jordan Lee 0323639e57 (trunk, libT) #4160 'foreign character support' -- merge mike.dld's 4160-02b-path.patch, which updates the codebase to use the new tr_sys_path_*() portability wrappers introduced in 4160-02a 2014-07-08 00:08:43 +00:00
Jordan Lee a2898f2ee9 (trunk, libT) #5656 'Problems renaming files' -- fixed, patch by rb07 2014-07-04 03:23:27 +00:00
Mitchell Livingston 0e01879974 Use built-in _WIN32 macro instead of WIN32 2014-07-04 00:00:07 +00:00
Mitchell Livingston 084273c106 Use built-in __APPLE__ macro instead of SYS_DARWIN and MACOSX 2014-07-03 19:20:12 +00:00
Jordan Lee 02cff80c2d Copyedit the license's revised text: (1) remove unnecessary repitition use of the word 'license' from the top of the header and source files (2) add the standard 'we hope it's useful, but no warranty' clause to COPYING (3) make explicit that linking OpenSSL is allowed (see https://people.gnome.org/~markmc/openssl-and-the-gpl.html for background) (4) sync the Qt and GTK+ clients' license popups with COPYING's revised text 2014-01-21 03:10:30 +00:00
Jordan Lee b342c2c180 (trunk, libT) #4089: 'magnet download not verified for existing data' -- patch by cfpp2p 2014-01-19 05:03:27 +00:00
Jordan Lee 4b9626bb83 Licensing changes:
1. add the option the code to be used under GPLv2 or GPLv3; previously only GPLv2 was allowed

2. add the "proxy option" as described in GPLv3 so we can add future licenses without having to bulk-edit everything again :)

3. remove the awkward "exception for MIT code in Mac client" clause; it was unnecessary and confusing.
2014-01-19 01:09:44 +00:00
Jordan Lee 4904b923fb (trunk) restore copyright year as suggested in email by rms 2014-01-18 20:56:57 +00:00
Jordan Lee 451d398aa6 (trunk, libT) #5427 'torrents start in pause' -- fix resume issue with que_restart_v2 patch by cfpp2p 2013-10-20 17:15:19 +00:00
Jordan Lee d9a6539e19 fix pedantic compiler warnings 2013-09-09 01:32:09 +00:00
Jordan Lee ea7d2482dd introduce TR_PRIuSIZE macro for portable printf()ing of size_t. mikedld 2013-09-08 17:32:09 +00:00
Jordan Lee 4c8bda8805 function pointer type correctness. mikedld 2013-09-08 17:08:18 +00:00
Jordan Lee 65f15a4ba9 more treating-bools-as-bools 2013-08-24 18:18:38 +00:00
Jordan Lee 28fe36f1f8 #include limits.h where we use it, and don't where we don't 2013-08-24 17:53:45 +00:00
Jordan Lee 35638e210e add inline wrapper functions to tr_torrent to decouple the rest of the code from tr_completion 2013-08-18 13:06:39 +00:00
Jordan Lee 6fc8481524 (trunk, libT) #5452 'preventing zombies from child scripts' -- fixed. 2013-08-05 13:07:23 +00:00
Jordan Lee 29e53df9d9 silence a pair of 'unused variable' gcc warnings 2013-07-27 17:48:59 +00:00
Jordan Lee fe79ad39bc add tr_sessionGetTorrents(), a private utility to avoid code duplication in libtransmission 2013-07-20 15:37:13 +00:00
Jordan Lee 7bcaf891d1 when a torrent finishes downloading, first rename/move the files (if there's a temp directory or .part suffix), then check to fire the completeness callback, then check to fire the ratio limit callback, then check to fire the done callback. 2013-07-16 00:50:45 +00:00
Jordan Lee 768142fcac change the callback functions' orders s.t. torrent-completed is called before torrent-done 2013-07-15 23:53:48 +00:00
Jordan Lee 058e430251 fix bug #5372, 'wrong peer states displayed'. 2013-07-08 16:41:12 +00:00
Jordan Lee 3fb74c4e00 (trunk, libT) fix tr_torrentStat() regression in the nightlies reported in #5294 by mw3demo 2013-05-27 21:04:48 +00:00
Jordan Lee e39c11316f whitespace/indentation 2013-05-23 00:11:09 +00:00
Jordan Lee 96aaa41218 safer implementation of tr_torrentName() 2013-05-22 22:56:13 +00:00
Jordan Lee 027e3f3066 (trunk, libT) #4682 'Add return id from duplicate torrent torrent-add rpc' -- added. 2013-05-22 20:35:38 +00:00
Jordan Lee cd09204a6e (trunk) first draft of changing the FreeSpace API to behave as https://trac.transmissionbt.com/ticket/4076#comment:25 -- libT, rpc, qt, and gtk implementations. 2013-02-09 04:05:03 +00:00
Jordan Lee 836fcc31d2 (libT) #5276 'regression in nightly: assert (tr_sessionIsLocked (session))': fix the bug; tests now pass again 2013-02-06 05:52:41 +00:00
Jordan Lee 445609f690 (trunk) prefer tr_remove() to unlink() or rmdir() 2013-02-04 21:53:19 +00:00
Jordan Lee 407c0b53c7 (trunk) add portability wrappers tr_rename(), tr_remove() for the rename() and remove() funcs s.t. utf16 can be handled 2013-02-04 21:45:20 +00:00
Jordan Lee 1f2bccd17b (libT) recycle the peer id used for public torrents after N hours of use 2013-02-02 13:42:50 +00:00
Jordan Lee 70289d9629 (libT) #5259 'Minor memory leaks in tr_torrentDeleteLocalData()': cleaner patch suggested by cfpp2p 2013-02-01 19:21:38 +00:00
Jordan Lee 69f3e31230 (libT) change the API signature for tr_torrentVerify() s.t. client code can be notified when the verify is finished 2013-01-31 21:58:25 +00:00
Jordan Lee 47d2a1ee8f (libT) add assertions to check that block-writing functions are only invoked in the libtransmission thread 2013-01-31 17:39:06 +00:00
Jordan Lee 4aa4012a73 fix race condition triggered in the unit tests by requiring a libtransmission thread lock in torrentRemove() 2013-01-31 05:05:44 +00:00
Jordan Lee d9940acf75 (libT) #5259 'Minor memory leak in tr_torrentDeleteLocalData()' -- fixed. 2013-01-27 06:19:33 +00:00
Jordan Lee 5f9e7f773b #5146 'seeding complete callback called twice': revert r13627 due to issues described in https://trac.transmissionbt.com/ticket/5146#comment:15 2013-01-27 06:02:52 +00:00
Jordan Lee 388da24dd0 (libT) add package-visible API hook for when a block is downloaded. Add unit test to confirm that when the last file finishes downloading, its .part suffix is removed and it's moved from the incomplete to complete dir 2013-01-26 23:08:51 +00:00
Jordan Lee f75027d5e9 make all the log functions/structs/enums use a single 'tr_log' namespace, such as tr_logGetQueue, tr_logAddInfo, tr_logIsLevelActive 2013-01-25 23:34:20 +00:00
Jordan Lee e34be5e573 (libT) rename-test tracers 2013-01-23 22:43:16 +00:00
Jordan Lee 3f4c9e9d2f (libT) #1220 'change file and folder names': handle .part file suffixs 2013-01-22 05:58:31 +00:00
Jordan Lee 2e354dfb10 (libT) #1220 'change file and folder names': fold tr_torrentRename() into tr_torrentRenamePath(); it's not useful enough on its own to be a separate function 2013-01-22 04:57:45 +00:00
Mitchell Livingston aae38eb05f (libT) update the rename callback to include the previous torrent name 2013-01-22 00:43:50 +00:00
Jordan Lee 434bd6b287 (libT) #1220 'change top folder names' -- when the root file/folder is changed, update tr_info.name too. 2013-01-22 00:25:42 +00:00
Jordan Lee dd955b121e (trunk) #1220 'change top folder names' -- add file-renaming to the Qt client 2013-01-20 01:31:58 +00:00
Jordan Lee 016f38f066 (trunk) #1220 'change top folder names' -- added support for this in libtransmission's C and RPC APIs. 2013-01-19 08:43:26 +00:00
Jordan Lee cb448dad6a minor code simplification in torrent.c's deleteLocalData() function. 2013-01-09 01:11:36 +00:00
Jordan Lee a9657d56ec replace tr_torrent's 'float etaSpeed_KBps' field with an 'unsigned int etaSpeed_Bps' field 2013-01-06 20:15:11 +00:00
Jordan Lee 9a70ffb4ee (libT) #4633 fix win32 regression introduced in r13752. 2013-01-04 19:47:01 +00:00
Jordan Lee cd0628fc8f (libT) #4633 'if executing the torrent-done script fails, log an error' -- done. 2013-01-04 01:48:35 +00:00
Jordan Lee 3c9640bb8f make tr_info.webseedCount and tr_info.trackerCount unsigned. 2012-12-30 22:06:45 +00:00
Jordan Lee 7081027041 #5191 'using a webseed doesn't update the remaining time' -- fixed with patch by cfpp2p. 2012-12-26 23:34:32 +00:00
Jordan Lee c1559f3cc4 (trunk, libT) first drop of the tr_quark patch. 2012-12-22 20:35:19 +00:00
Jordan Lee 11b4431e09 (trunk, libT) #5176 'Deselecting all remaining files not working correctly' -- fix trunk regression. 2012-12-19 07:59:49 +00:00
Jordan Lee aea6d7cd6f (trunk, libT) #5168 'make libtransmission's public funcs nonblocking when possible' -- remove tr_torrentRef() and tr_torrentUnref() as discussed in https://trac.transmissionbt.com/ticket/5168#comment:8 2012-12-14 20:04:37 +00:00
Jordan Lee e96ed247fe refactor libtransmission's tr_benc class as tr_variant. 2012-12-14 04:34:42 +00:00
Jordan Lee e1c338b6c3 (trunk, libT) #5169 fix FTBFS in torrentStart() 2012-12-13 05:22:30 +00:00
Jordan Lee e2f1d6744e fix another pair of #5168 oopses (oopsii?) 2012-12-12 21:19:25 +00:00
Jordan Lee 079c78981c (trunk) #5168 'make libtransmission's public funcs nonblocking when possible' -- first attempt. 2012-12-12 20:22:57 +00:00
Jordan Lee a2d2a10226 (trunk, libT) #5165: fix r13625 oops 2012-12-07 01:53:31 +00:00
Jordan Lee ccb4a16ab8 (trunk, libT) #5146 'seeding complete callback called twice' -- fixed with patch from x190. 2012-12-05 22:56:45 +00:00
Jordan Lee 3d38723ad9 Follow more common whitespace style conventions in the C code (libtransmission, daemon, utils, cli, gtk). 2012-12-05 17:29:46 +00:00
Jordan Lee a981f4b6a6 (trunk, libT) #5097 'Rare buffer overflow (piece index too big)' -- fixed. 2012-10-20 15:57:56 +00:00
Jordan Lee 8fb80f5132 (trunk, libT) #4638 "Transmission sends an initial 'stopped' event when adding a torrent via RPC" -- fixed. 2012-10-15 03:11:16 +00:00
Mitchell Livingston 723d681b63 Whoops! Revert new changes committed in r13469 2012-09-06 03:23:50 +00:00
Mitchell Livingston 9e7e64fe04 Revert r13468 for now. 2012-09-06 03:21:03 +00:00
Jordan Lee 9b98c0fc2e (trunk libT) #4969 "jsonrpc response to torrent-get emits malformed json" -- fixed. 2012-07-14 19:34:38 +00:00
Jordan Lee f55ab8dddb (trunk libT) move torrent.c's private function fileExists() to the utility function tr_fileExists() so that it can also be used by stats.c 2012-07-01 03:05:36 +00:00
Jordan Lee 3398a48e57 (trunk libT) #4402 "Transmission Bandwidth allocation getting overflows" -- use gvdl's patch '4402-uint-bpsoverflow.patch' 2012-07-01 02:17:35 +00:00
Jordan Lee 43f7dc4c17 (trunk libT) fix minor memory leak of the 'dir' string when deleting local data. (Thanks, valgrind!) 2012-02-04 03:09:31 +00:00
Jordan Lee b3d382874a (trunk libT) #4625 "Transmission 2.42 fails to build on Solaris 10: Undefined symbol 'mkdtemp'" -- fixed. 2011-11-10 03:31:43 +00:00
Jordan Lee 1aefd9f1de munge tr_torrent's memory immediately before freeing it. 2011-09-28 16:06:19 +00:00
Jordan Lee 0fde2ddc8e in freeTorrent(), don't destruct the torrent's completion field until after calling tr_announceRemoveTorrent() 2011-09-26 05:57:03 +00:00
Jordan Lee 3a3cef615c #4344 'zero peers observed with 2.32' -- experimental change suggested by gunzip 2011-09-21 00:20:02 +00:00
Jordan Lee 46154e7309 (trunk libT) add a magnet link check to deleteLocalData(). Thanks to plaes for reporting this issue. 2011-09-16 23:08:35 +00:00
Jordan Lee 56e47e96d0 (trunk libT) improve the is_same_file() test in deleteLocalData() to handle nonexistent directories too. 2011-08-20 18:41:45 +00:00
Jordan Lee a14e72b1f7 (trunk libT) #4377 "Incomplete Folder removed when sub-folder of Default Location" -- fix r12665-r12667 regression reported by KyleK in comment:31 2011-08-16 22:42:43 +00:00
Jordan Lee ecb2054493 (trunk libT) #4377 "Incomplete Folder removed when sub-folder of Default Location" -- another revision to r12665 2011-08-12 01:56:35 +00:00
Jordan Lee 6d36b3d763 (trunk libT) #4377 "Incomplete Folder removed when sub-folder of Default Location" -- minor revision to r12665 to fix a minor memory leak with the 'subpath' string. 2011-08-11 21:02:15 +00:00
Jordan Lee d9541de52d (trunk libT) #4377 "Incomplete Folder removed when sub-folder of Default Location" -- possible fix. 2011-08-11 14:16:29 +00:00
Jordan Lee 313bd9e211 Add a mechanism for enabling/disabling the stalled minutes feature. This is a pre-existing feature in the Mac client. 2011-08-07 19:24:33 +00:00
Jordan Lee fbc2eb1a65 silence a minor compiler warning when building with -DNDEBUG 2011-08-05 17:03:34 +00:00
Jordan Lee 7915b49b03 revert the last commit -- the Mac client uses the isIdle flag to know when hibernation is allowed 2011-08-04 04:31:14 +00:00
Jordan Lee d8a11a33f1 tr_torrentIsStalled(): return false if that torrent's queue is disabled. 2011-08-04 02:25:38 +00:00
Jordan Lee ae89e4683d add user_data (void *) to the queue callback 2011-08-03 23:40:51 +00:00
Jordan Lee ce77935009 Add a callback to be invoked when the queue starts a torrent. 2011-08-03 03:14:57 +00:00
Jordan Lee 3430ce714c #671 "torrent queuing" -- fix r12611 oops 2011-08-02 14:03:43 +00:00
Jordan Lee 307754e807 #671 "torrent queuing" -- modify the queue implementation s.t. every torrent has a queuePosition, even if it's not currently in the queue. 2011-08-02 03:59:54 +00:00
Jordan Lee 2e9d419bd4 #671 "torrent queuing" -- add a tr_stat.isStalled flag. 2011-08-01 23:27:11 +00:00
Jordan Lee 61174b007e (trunk) #671 "torrent queuing" -- Preliminary implementation. Covers libtransmission; GTK+ and Qt clients, and rudimentary web client support. 2011-08-01 22:24:24 +00:00
Jordan Lee 8ae478a62f (trunk libT) #4395 "Crash when removing data for incomplete magnetized torrent file" -- fixed. 2011-07-30 13:11:06 +00:00