Commit Graph

95 Commits

Author SHA1 Message Date
Mike Gelfand 088c5c6ab9 Bump DHT version used in CMake scripts (includes latest Win32 fixes) 2015-06-08 19:54:51 +00:00
Mike Gelfand 2e6d5c8bc9 Add more booleans to the picture 2015-05-31 22:13:31 +00:00
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 cefc477918 Fix a couple more MinGW/MSVC warnings. 2015-03-19 19:13:23 +00:00
Mike Gelfand 949e02b933 Define and use tr_socket_t and TR_BAD_SOCKET instead of int and -1.
Test socket validity by comparing to TR_BAD_SOCKET instead of various
(and sometimes wrong) other tests like `x >= 0`, `x != -1`, `x > 0`,
`x > -1`, `x` (valid), and `x < 0`, `x == -1` (invalid).
2015-03-18 07:34:26 +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 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
Jordan Lee be290162c2 (trunk) #4160: mike.dld patch: 4160-07-env.patch 2014-09-21 18:05:14 +00:00
Jordan Lee 01196c8c4f mikedld patch: 4160-05b-file-fmt.patch 2014-09-21 18:01:36 +00:00
Mitchell Livingston 0e01879974 Use built-in _WIN32 macro instead of WIN32 2014-07-04 00:00:07 +00:00
Jordan Lee 6ee973aaac (trunk) #5671 'dht-0.22': update third-party/dht.c to Juliusz Chroboczek's upstream v0.22 2014-05-05 20:45:14 +00:00
Jordan Lee 605e2e89ad use evutil_socket_t instead of int to define socket types. Patch my mikedLd :) 2013-09-08 17:03:11 +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 c1559f3cc4 (trunk, libT) first drop of the tr_quark patch. 2012-12-22 20:35:19 +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 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 d010e33c32 (trunk, libT) #4886 'IPv6-only DHT.dat not being written' -- fixed. bug found & patched by jch. 2012-11-11 14:42:14 +00:00
Juliusz Chroboczek 7eda3ae2ec Add stub for the DHT blacklisting support.
Using blacklists with Kademlia is not a good idea, which is why we
don't support it in Transmission.  However, some people insist on
implementing the support in their own copies, this well-defined
hook ensures that at least they'll do it right.
2011-07-25 21:30:46 +00:00
Juliusz Chroboczek 17d1210b95 Reword debugging messages for the IPv4 DHT.
The IPv6 DHT is no longer expermiental, no need for the asymmetry.
2011-07-25 19:53:39 +00:00
Jordan Lee 7b71470ea0 (trunk libT) #4351 "DHT can't be uninitialized during a session" -- don't process incoming DHT messages if DHT is disabled. Don't process incoming UTP messages if UTP is disabled. 2011-07-12 12:26:24 +00:00
Jordan Lee c7a43efc2b (trunk libT) fix file descriptor leak in tr-dht.c 2011-03-31 03:37:24 +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 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 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 9bf2434e14 (trunk) copyediting: remove trailing spaces from source code lines in daemon/ gtk/ libtransmission/ and utils/ 2011-03-04 23:26:10 +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 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 fc1c5fe553 (trunk libT) silence some unused variable warnings from gcc when building with -DNDEBUG 2011-02-02 05:18:33 +00:00
Juliusz Chroboczek 62cb43a173 Don't complain about unexpected DHT packets. 2011-01-09 23:54:54 +00:00
Juliusz Chroboczek cc44725949 #3634 Use dht-0.17 2011-01-09 23:45:04 +00:00
Juliusz Chroboczek 1ef888f9f1 Fix incorrect usage of event_new in UDP code.
Apparently you need to pass session->event_base as the first argument.
2011-01-09 23:14:17 +00:00
Juliusz Chroboczek 7af100fa7e Update tr-{dht,udp} to libevent2. 2011-01-09 21:48:51 +00:00
Juliusz Chroboczek aa3868df06 Move handling of UDP I/O to tr-udp.c. 2011-01-09 21:48:46 +00:00
Juliusz Chroboczek 0d8c10716c Use the dht-0.16 API in tr-dht.c.
Recvfrom is now done outside the dht code, which makes it possible to share
the socket with UTP.
2011-01-09 21:48:43 +00:00
Juliusz Chroboczek abcd56c034 Move creation of the UDP sockets to tr-udp.c. 2011-01-09 21:48:36 +00:00
Juliusz Chroboczek 5b2948cd17 Improve error messages in tr-dht.c. 2011-01-08 02:12:23 +00:00
Juliusz Chroboczek fe2fd2efcf Avoid a descriptor leak when binding the IPv6 DHT socket fails. 2011-01-08 01:09:12 +00:00
Charles Kerr e5bb3205a1 (trunk) Join the 21st century and use only 1 space at the end sentences. This commit is nearly as important as the semi-annual ones that remove trailing spaces from the ends of lines of code... :) 2010-12-27 19:18:17 +00:00
Charles Kerr ae84dc70dd (trunk libT) #3836 "libevent2 support" -- finish moving to the libevent2 API mode. don't include the backwards-compatable API headers. 2010-12-24 08:58:41 +00:00
Charles Kerr 345b14adbc (trunk) #3836 "libevent2 support" -- bump libevent2 requirement to 2.0.10. This will break the Mac build for a minute intil BMW applies his Mac patch 2010-12-20 02:07:51 +00:00
Charles Kerr 8e548aafcb (trunk libT) #3687 "The V=XXXX key/val pair in our DHT messages seems to have no purpose" -- removed. 2010-10-30 01:48:45 +00:00
Daniel Lee 3f8748edfc change 'v' field in dht to use major/minor version instead of svn revision 2010-10-13 17:09:05 +00:00
Charles Kerr 56e90f1457 (trunk) more "svn propset" tweaks for $Id$ 2010-10-01 20:22:51 +00:00
Charles Kerr 5a8c94cfe4 (trunk libT) #3382 "2.01+ (10919) hangs after launch" -- fixed. 2010-07-01 16:09:47 +00:00
Charles Kerr 954a309d8f (trunk) #3311 "MingW build of Transmission" -- apply more of rb07's diffs, though edited to lessen the inevitable #ifdefs 2010-06-30 21:24:36 +00:00
Charles Kerr 5ad7ed550f (trunk) more win32 fixes from rb07 in #3311 2010-06-22 00:12:52 +00:00
Charles Kerr 08628333d1 (trunk libT) part of rb07's win32 portability patches from ticket #3311 2010-06-21 16:44:35 +00:00