Commit Graph

184 Commits

Author SHA1 Message Date
clyang 81c9653383 Improve ToS on IPv6 connections 2017-08-03 06:30:54 +03:00
Mike Gelfand 18aabdeb06 Introduce peer socket struct to improve readability 2017-06-28 18:50:05 +03:00
Mike Gelfand 13bbaeec76 Use field initializers for readability 2017-06-24 13:30:33 +03:00
Mike Gelfand deea6fc6a2 Bring assertions closer to the beginning of blocks 2017-06-13 07:44:09 +03:00
Mike Gelfand 98695fe3c1 Introduce our own assertion macros with finer control 2017-06-08 10:24:12 +03:00
Mike Gelfand e1d53855f4 Avoid declaring multiple variables on the same line 2017-05-01 18:46:41 +03:00
Mike Gelfand efaa9d0ddc Compare system function return value to a specific value indicating the error 2017-04-30 19:47:18 +03:00
Mike Gelfand a762c770f2 Make conditional expressions explicitly boolean 2017-04-30 19:26:01 +03:00
Mike Gelfand 4f9d9ad92b Code style change leftovers
For some reason, GTK client wasn't fully processed. All the rest of changes
are mostly in comments.
2017-04-21 10:40:57 +03:00
Mike Gelfand dadffa2c0f Align type qualifiers to the right (code style)
This way all the qualifiers (`const`, `volatile`, `mutable`) are grouped
together, e.g. `T const* const x` vs. `const T* const x`. Also helps reading
types right-to-left, e.g. "constant pointer to constant T" vs. "constant
pointer to T which is constant".
2017-04-20 19:53:20 +03:00
Mike Gelfand d7930984ef Adjust uncrustify config, reformat all but Mac client
There're places where manual intervention is still required as uncrustify
is not ideal (unfortunately), but at least one may rely on it to do the
right thing most of the time (e.g. when sending in a patch).

The style itself is quite different from what we had before but making it
uniform across all the codebase is the key. I also hope that it'll make the
code more readable (YMMV) and less sensitive to further changes.
2017-04-20 10:01:22 +03:00
neheb 944382a62e Add TCP_FASTOPEN support
Should make transmission slightly faster.
2017-02-19 12:54:01 +03:00
Mike Gelfand 1cc67b31dd Use PRIdMAX instead of TR_PRI_SOCK to accomodate intltool 2017-01-27 04:50:14 +03:00
Mike Gelfand 2248d3670f Get rid of $Id$ SVN keywords in source files 2016-09-02 23:10:15 +03:00
Mike Gelfand 72f9dc6f92 #5992: Remove now obsolete check for 13th Baktun (already happened) 2015-10-16 19:49:07 +00:00
Mike Gelfand 0420699ad6 Initialise networking in daemon before making libevent calls 2015-10-11 16:35:51 +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 4a23c94252 Fix some issues revealed by coverity 2015-05-09 14:09:05 +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 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 9a3b965ce4 Kill some warnings when compiling on Windows 2015-01-02 04:02:13 +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 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
Mitchell Livingston 0e01879974 Use built-in _WIN32 macro instead of WIN32 2014-07-04 00:00:07 +00:00
Jordan Lee 5a2268289e (trunk, libT) #5651 'int to bool patch' -- fixed, patch by rajmannugetr 2014-04-27 23:10:01 +00:00
Jordan Lee 6bcdd93e45 (trunk libT) #5318: 'socket leak when bind() fails': fixed. 2013-04-13 19:34:34 +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 a2d2a10226 (trunk, libT) #5165: fix r13625 oops 2012-12-07 01:53:31 +00:00
Jordan Lee 519feefcb4 (trunk, libT) #5157 -- fix r13628 oops 2012-12-06 00:50:40 +00:00
Jordan Lee 61c1f7efec (trunk, libT) #5157 'check valid address before UTP_Create()' -- added. 2012-12-05 23:48:00 +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 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 2786136015 (trunk) #4490 "Transmission 2.40b1 fails to build: undefined references" -- fixed. 2011-10-08 23:53:27 +00:00
Juliusz Chroboczek 232075f547 Reinstate including tcp.h in net.c.
Removed in r12225, this broke netSetCongestionControl.
2011-04-02 16:43:17 +00:00
Jordan Lee 1b825079be (trunk libT) API cleanup of the tr_address functions to make them more consistent.
This is loosely related to #2910, but only in the sense of laying the groundwork for #2910's fix...
2011-03-25 05:34:26 +00:00
Jordan Lee 87ef45cf3d (trunk libT) copyediting: remove a bunch of seemingly-unneeded network headers in net.[ch].
I'm less certain that these are unneeded because networking APIs seem to have more variation between platforms, but it's better to remove the cruft and then add back whatever headers $PLATFORM users complain about, than to not remove the cruft at all...
2011-03-24 22:57:39 +00:00
Jordan Lee 375694eda9 (trunk) copyediting: remove some unneeded #includes, and annotate some needed ones 2011-03-24 21:49:42 +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 cdff3aa090 (trunk libT) minor tweak: use evutil_closesocket() instead of the older EVUTIL_CLOSESOCKET() macro. 2011-03-13 19:47:21 +00:00
Jordan Lee 4a4842fea5 (trunk libT) use libevent2's portability wrappers for inet_ntop() and inet_pton().
We currently implement our own versions of these on mingw because that platform doesn't have them... but why reinvent the wheel; libevent has already done the same thing. Let's use libevent2's implementation.
has already done it for us.
2011-03-13 08:15:40 +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
Jordan Lee 3fdd80eb0d (trunk libT) new function: tr_ssToAddr()
This handles converting the data in a sockaddr_storage to a tr_address + port, and removes redundant code from fdlimit.c and tr-udp.c that previously did this work.
2011-03-04 21:00:52 +00:00
Juliusz Chroboczek e7fc697c90 Stub out UTP_Create in non-uTP builds. 2011-02-18 16:01:52 +00:00
Jordan Lee cd04051de8 add configure script switch to enable/disable utp 2011-02-18 00:45:44 +00:00
Juliusz Chroboczek 88f4eac81f Implement outgoing uTP connections. 2011-02-18 00:36:19 +00:00
Jordan Lee 879a2afcbd Update the copyright year in the source code comments.
The Berne Convention says that the copyright year is moot, so instead of adding another year to each file as in previous years, I've removed the year altogether from the source code comments in libtransmission, gtk, qt, utils, daemon, and cli.

Juliusz's copyright notice in tr-dht and Johannes' copyright notice in tr-lpd have been left alone; it didn't seem appropriate to modify them.
2011-01-19 13:48:47 +00:00
Charles Kerr a17962d5fc (trunk libT) #3528 "TR_PREFS_KEY_BIND_ADDRESS_IPV4 breaks IPv6-only trackers" -- Implement suggestion #2 from Harry 2010-12-30 19:15:47 +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