Previously `bandwidth.allocate()` was called twice in a row, once for
upload bandwidth and once for download bandwidth.
It has some semi-expensive housekeeping though, so avoid doing that work
twice by having a single call to `bandwidth.allocate()` operate on both
up and down bandwidth.
* refactor: remove unused field tr_torrent.prefetchMagnetMetadata
* refactor: remove unused field tr_torrent.dhtAnnounce6InProgress
* refactor: remove unused field tr_torrent.dhtAnnounceInProgress
* refactor: fold etaULSpeed and etaDLSpeed into one field
* refactor: re-arrange fields to avoid padding
* chore: allow vararg calls in qt/.clang-tidy
An awkward PR since this isn't intended for the qt/ codebase at all, but
rather for use with libtransmission instead. But libtransmission is *so*
noncompilant at this point that this config can't be promoted higher up
the tree yet. Instead, it needs to be callable on-request by devs.
* refactor: make clang-tidy happy with bandwidth.h, .cc
* refactor: use getFooSpeedBytesPerSecond()
* refactor: make tr_peerIo a class
No behavioral changes.
Use `new` and `delete` and change `struct` references to `class`.
* refactor: make some tr_peerIo fields const
* refactor: reorganize tr_peerIo fields to remove padding holes
* refactor: remove redundant field tr_peerIo.isIncoming
* refactor: make tr_peerIo.inbuf, .outbuf fields const*
* Modernize bitfield.cc: Rename tr_bandwidth to Bandwidth; Move dependent structs and consts into it
* Modernize bitfield.cc: Rename internal fields to lower_snake_case_ with suffix underscore
* Modernize bitfield.cc: Remove struct in 'struct Bandwidth' type usages
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* Modernize bandwidth.cc: Move functions inside struct
* Modernize bandwidth.cc: Review notes - remove extraneous checks, move small functions into .H file, etc
* Modernize bandwidth.cc: Construction and destruction is now via C++ new/delete
* Modernize bandwidth.cc: Rename used() to notifyBandwidthConsumed()
* Modernize bandwidth.cc: Children is now unordered_set
* Modernize bandwidth.cc: Allocation functions for peer bandwidth are now using std::vector instead of ptrArrays
* Modernize bandwidth.cc: Code formatting
* Modernize bandwidth.cc: Private fields after public; Minor review notes
* Modernize bandwidth.cc: Ungroup enums into constants; Docs minor update
* Modernize bitfield.cc: Docs comments changes; Using constexpr instead of const
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case
* MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a
literal suffix
* CERT DCL16-C. - Use "L," not "l," to indicate a long value
* CERT, DCL50-J. - Use visually distinct identifiers
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".
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.
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.