Commit Graph

627 Commits

Author SHA1 Message Date
Mike Gelfand 2321bc3fad Fix some issues revealed by coverity 2015-05-09 08:37:55 +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 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 440f482d01 Replace tabs with spaces; remove trailing spaces 2015-01-02 11:15:31 +00:00
Mike Gelfand c845e35ce1 Fix format specifier warning introduced couple commits earlier 2014-12-13 17:04:14 +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 74c6719bb2 #5407: Fix crash on Mac when pausing torrents (patch by x190) 2014-12-11 19:57:52 +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 b939f98ec7 (trunk, libT) #5709 'Fix an instance of time_t printing' -- fixed, patch by naddy 2014-07-03 19:28:21 +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 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 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 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 0f1f84898b silence a small handful of minor gcc compiler warnings in libtransmission 2013-08-17 17:20:31 +00:00
Jordan Lee de248c94fb in peer-msgs.c's tr_peerMsgsCalculateActive(), adjust some of those new tracer assertions to work better with magnet links. 2013-07-09 17:05:32 +00:00
Jordan Lee 0c507637db in peer-mgr.c's tr_peerMgrGetDesiredAvailable(), confirm we have a swarm pointer before using it. Probable fix for bug #5407 2013-07-08 17:46:12 +00:00
Jordan Lee 058e430251 fix bug #5372, 'wrong peer states displayed'. 2013-07-08 16:41:12 +00:00
Jordan Lee 43b3a47661 (trunk, libT) #53737 fix 2.77+ nightly regression that misreported the number of webseeds 2013-06-09 18:56:10 +00:00
Jordan Lee 30882e69b1 (trunk libT) fix 2.7x crash when dealing with webseeds 2013-06-09 18:39:24 +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 094af58f29 undo previous commit's accidental inclusion of changes to peer-msgs.* and peer-mgr.c 2013-05-22 19:06:54 +00:00
Jordan Lee d81f956daa (trunk, libT) #5356 'only set CURLOPT_COOKIEFILE if cookies.txt exists on startup' -- fixed. 2013-05-22 19:02:07 +00:00
Jordan Lee 96691dd019 (libT) make the class hierarchy between tr_peer, tr_peerMsgs, and tr_webseed a little less ad-hoc 2013-02-04 16:23:33 +00:00
Jordan Lee 8a33a1b315 (libT) increment the announced downloadCount only when the piece becomes complete. 2013-01-30 20:06:12 +00:00
Jordan Lee 553bd58681 (libT) peer-mgr doesn't care about non-piece data being transferred, so don't notify it when it happens 2013-01-30 18:00:03 +00:00
Jordan Lee e85ece214e (libT) rename internal struct 'tr_torrent_peers' as 'tr_swarm' 2013-01-27 21:03: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 ad3407567b (libT) copyediting: modify more files to the new indentation/whitespace formatting 2013-01-24 23:59:52 +00:00
Jordan Lee bcc130e804 in getReconnectIntervalSecs(), raise the interval between reconnection attempts if the peer was previously unreachable 2013-01-17 20:08:21 +00:00
Jordan Lee 4d627b79c2 (libT) tweak getMaxAtomCount() 2013-01-17 01:10:59 +00:00
Jordan Lee 3c9640bb8f make tr_info.webseedCount and tr_info.trackerCount unsigned. 2012-12-30 22:06:45 +00:00
Jordan Lee aa906ced75 (trunk, libT) #5199 'tr_sessionGetNextQueuedTorrent() can be faster' -- modify session.c's tr_sessionGetNextQueuedTorrents() and peer-mgr.c's getPeerCandidates() functions use the new tr_quickfindFirstK() utility" 2012-12-28 20:10:03 +00:00
Jordan Lee 7ff9e2d2ba copyediting: correct a couple of code comments. 2012-12-28 08:35:14 +00:00
Jordan Lee c1559f3cc4 (trunk, libT) first drop of the tr_quark patch. 2012-12-22 20:35:19 +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 399c3233b7 remove a couple of unnecessary torrentIsLocked() assertions for #5168 2012-12-12 20:57:13 +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 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 ebd4b5e386 (trunk, libT) #5063 'remaining time unknown with magnets that have webseeds' -- fixed. 2012-10-05 22:04:08 +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 99b615b3b8 (trunk libT) #4931 "Wrong peer percentages for magnetized transfers" -- fixed.
tr_peerUpdateProgress() is guessing at the progress size, but when we don't have the data size yet that guess isn't very good. Add boundary
 clamps on the peer.progress field.
2012-07-01 02:00:02 +00:00
Jordan Lee d717248e75 (trunk libT) fix the Linux build wrt compiling with the new snapshot of libutp checked into r13317
Previously we made sure to include stdbool.h (via transmission.h) before utp.h, since the latter used 'bool' without defining it. The new snapshot defines it unconditionally in non-C++ code, so now we need to include it first.
2012-05-30 17:47:29 +00:00
Jordan Lee cac5c360f2 (trunk libT) #4690 "getPeerCandidates() uses more CPU than necessary" -- fixed.
Once we've scored all n candidates, we sort them by score so that we can pick out the k best candidates. If n is large, sorting them can be expensive. If we use the Selection Algorithm, we select in O(n) without having to sort.
2011-12-31 21:28:53 +00:00
Jordan Lee 2786136015 (trunk) #4490 "Transmission 2.40b1 fails to build: undefined references" -- fixed. 2011-10-08 23:53:27 +00:00
Jordan Lee bf6c2a0df7 peer.have was being initialized to the block count, rather than the piece count, resulting in wasted overhead. 2011-09-26 22:48:50 +00:00
Jordan Lee daa795fb6a #4496 'freeze when having a huge torrent' -- more tweaks based on Shark reports from MechMK1 2011-09-21 23:04:39 +00:00