Commit Graph

4398 Commits

Author SHA1 Message Date
Mike Gelfand a90a473d48 #6003: Update to miniupnpc api 14 (slightly modified patch by infirit) 2015-10-04 04:53:18 +00:00
Mike Gelfand 18ea8c429a Improve RPC performance for local sessions
Don't unnecessarily de-/serialize JSON data if local session is used.
2015-07-13 00:32:48 +00:00
Mike Gelfand b9adf279ca #5912: Prevent completed pieces modification by webseeds (patch by cfpp2p)
This avoids blocks corruption in case webseed provides bad data.

As explained by cfpp2p, "The requirements to reproduce are at least one
webseed that sends corrupt block(s), and at least one other peer (webseed
or regular peer) that sends correct data for the same block. Then a peer
with correct block sends the block and transmission accepts and verifies
that block as good. But then the webseed thread comes around and the same
block is downloaded from the webseed that sends a bad block which is then
written even though the piece was previously deemed complete."
2015-07-05 07:54:46 +00:00
Mike Gelfand 6cbfcdc85e Fix `tr_net_strerror` on Windows (oops) 2015-07-01 00:58:00 +00:00
Mike Gelfand 79195614b2 Use `sockerrno` and `tr_net_strerror` for most of network-related errors
This ensures proper network errors formatting on Windows.

Also, disable IP_TOS socket option modification attempts on Windows
since it's not supported there and is considered deprecated: "Do not
use. Type of Service (TOS) settings should only be set using the
Quality of Service API" (c) MSDN. Using QoS API is a subject for
separate commit(s).
2015-07-01 00:54:41 +00:00
Mike Gelfand ba7ea94c7d Avoid assert on passing negative values to `isprint` (due to type promotion) 2015-06-26 21:22:27 +00:00
Mike Gelfand 2b5a03a88c #5964: Another follow-up commit for #5456 (encrypted communication with libevent 2.1.x)
Decrypt only what is asked for, not more. This fixes previous commit
which changed semantics by processing the buffer to the very end,
starting with correct offset though.

Refactor encryption/decryption to a single function which callback.
2015-06-24 21:24:41 +00:00
Mike Gelfand cdcc9e249f #5964: Follow-up fix for #5456 (encrypted communication with libevent 2.1.x)
I've misread libevent documentation and the check introduced was not
entirely correct. Changed `evbuffer_peek` call now to only request the
data which would fit into provided iovec.
2015-06-24 20:38:41 +00:00
Mike Gelfand 6101a69957 Avoid possible `_XOPEN_SOURCE` redefinition warning 2015-06-23 21:16:33 +00:00
Mike Gelfand 45b73a7866 #5456: Fix encrypted communication with libevent 2.1.x
Recent versions of libevent changed the semantics of `evbuffer_ptr_set`
function in a way that it succeeds if pointer is set right after the end
of the buffer. This caused `tr_cryptoEncrypt` and `tr_cryptoDecrypt` to
be called twice for last buffer chunk since no checks for `evbuffer_peek`
return value were made while it was returning 0 on last loop cycle,
leaving iovec unchanged.
2015-06-17 20:32:33 +00:00
Mike Gelfand 088c5c6ab9 Bump DHT version used in CMake scripts (includes latest Win32 fixes) 2015-06-08 19:54:51 +00:00
Mike Gelfand 2804335d05 Don't print trailing space char on each line when saving JSON 2015-06-01 20:50:25 +00:00
Mike Gelfand 5d48c2d3e9 #5851: Don't use _configthreadlocale if not provided by CRT (even if declaration is present) 2015-06-01 18:52:14 +00:00
Mike Gelfand ae5755dc1e #5851: Use per-thread locale setup if possible
This prevents crashes on concurrent tr_variantFromBuf, tr_variantToBuf
and tr_variantGetReal use.
2015-06-01 05:25:14 +00:00
Mike Gelfand 2e6d5c8bc9 Add more booleans to the picture 2015-05-31 22:13:31 +00:00
Mike Gelfand 6c04259c39 Remove useless ws2tcpip.h include in net.h
It's already included above, and QT_DLL condition is meaningless
since net.h is only being used inside libtransmission which doesn't
use Qt.
2015-05-30 15:44:17 +00:00
Mike Gelfand 8dd65cdfba Use CreateProcess instead of _spawnvpe to execute scripts on Windows 2015-05-30 11:15:57 +00:00
Mike Gelfand 7abe7c28a3 #4882: \u-encode all non-printable (as opposed to non-ascii) characters 2015-05-16 17:33:01 +00:00
Mike Gelfand e0dc1d6735 Fix some issues revealed by coverity 2015-05-09 14:10:55 +00:00
Mike Gelfand 4a23c94252 Fix some issues revealed by coverity 2015-05-09 14:09:05 +00:00
Mike Gelfand cdf3cf62f9 Fix some issues revealed by coverity 2015-05-09 11:56:35 +00:00
Mike Gelfand 2321bc3fad Fix some issues revealed by coverity 2015-05-09 08:37:55 +00:00
Mike Gelfand df98031294 #5946: Save "prefetch-enabled" setting as boolean (spotted by cfpp2p) 2015-05-07 06:45:35 +00:00
Mike Gelfand 5de8bbe6d8 Cut internal macro names to have equal number of underscores on each side (take two) 2015-05-04 20:06:05 +00:00
Mike Gelfand 7879100c01 Cut internal macro names to have equal number of underscores on each side 2015-05-04 19:58:34 +00:00
Mike Gelfand 0c01e6e19d #5937: Don't send TR_RPC_TORRENT_ADDED notification if torrent wasn't actually added (patch by xzcvczx) 2015-04-29 19:42:05 +00:00
Mike Gelfand b89b90ee15 Avoid GCC `'static' is not at beginning of declaration` warning 2015-04-21 11:40:15 +00:00
Mike Gelfand c1b10abe0f Use UTF-8 for console I/O on Windows 2015-04-21 10:07:57 +00:00
Mike Gelfand 829cbffaf7 Add version info to executables (on Windows). Group projects into folders (CMake). 2015-04-14 22:46:40 +00:00
Mike Gelfand 53a0fc2a19 Allow files (and their parent directories) to be renamed even when in use (on Windows). 2015-04-13 18:31:32 +00:00
Mike Gelfand 7bf402bb7d Forward-declare `tr_error` structure in headers 2015-04-11 14:54:01 +00:00
Mike Gelfand b58621c683 Add ERROR_DIRECTORY_NOT_SUPPORTED define missing in MinGW 2015-04-11 10:58:08 +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 99e0f5bd63 Tune directory paths on Windows
Use %USERPROFILE% instead of %USERPROFILE%\Documents as home directory.
Don't roam configuration directory (I don't think we want that).
Use known Downloads folder (instead of %HOME%\Downloads) if set.
When searching for web interface files, let local user application data
directory override roaming one, and roaming one override common one.
Use Vista+ API (SHGetKnownFolderPath) to get known folder paths.
2015-04-10 22:15:41 +00:00
Mike Gelfand 7bfcbe55e1 #5920: Fix memory leak and access to freed memory in tr_getDefaultConfigDir (patch by jyelloz) 2015-04-05 06:39:06 +00:00
Mike Gelfand c768af3865 #5407: Fix crash on Mac when pausing torrents (patch by x190) 2015-03-26 18:32:33 +00:00
Mike Gelfand 12095175a1 Do not return `-EINVAL` as socket value (obviously not a good idea).
Also, fix socket descriptor leak in `tr_netBindTCPImpl` if `IPV6_V6ONLY` is defined.
2015-03-26 18:29:11 +00:00
Mike Gelfand cefc477918 Fix a couple more MinGW/MSVC warnings. 2015-03-19 19:13:23 +00:00
Mike Gelfand 45983e66e6 Fix a couple of MinGW warnings. 2015-03-19 06:08:06 +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 3f9575fcc8 Minor type adjustments (incomplete, it takes way too much time) 2015-03-15 11:43:32 +00:00
Mike Gelfand 2331cee776 #5505: Temporarily comment assert out so that nightly builds are usable again 2015-03-11 06:22:11 +00:00
Mike Gelfand a2037bdbbd Define one of LFS macros instead of using xxx64 functions directly.
There're too many functions and types to consider, and benefits of not
using LFS macros aren't that big (I was thinking of using fts(3) but
that may not happen soon or at all).
2015-03-10 22:31:09 +00:00
Mike Gelfand 8c511dc590 Use lseek64 instead of lseek, if available (large files on 32-bit systems) 2015-03-08 19:14:24 +00:00
Mike Gelfand 806f81c05c #5881: Explicitly state all possible crypto backend source files so that they are included into archive by `make dist` 2015-01-21 22:32:27 +00:00
Mike Gelfand 5ab451242d Do not write timezone to log, not a good idea after all (no standardized format) 2015-01-13 21:09:21 +00:00
Mike Gelfand fe47350656 Further adjustments to support PolarSSL 1.2 2015-01-07 14:05:58 +00:00
Mike Gelfand 30690fcf99 Lower minimum PolarSSL version required down to 1.2 2015-01-07 13:41:22 +00:00
Mike Gelfand c3afe215d5 Fix copyright years and SVN attributes on new files 2015-01-07 13:20:56 +00:00
Mike Gelfand d877fb9cde Add PolarSSL support 2015-01-07 13:19:00 +00:00