* chore: housekeeping
* perf: short circuit peer has block check
* refactor: track active requests in each respective peer
* refactor: swap `ActiveRequests` with new request tracking method
* refactor: use bitfield to store active requests per peer
* perf: check active request numbers first
* refactor: initialise candidate values in constructor
* refactor: better naming
* refactor: use `find_by_block()` more
* refactor: store wishlist mediator in swarm object
* test: make it compile
* test: update endgame test
* test: new test for choke event
* test: remove redundant lines
* test: new test for request event
* test: new test for reject event
* refactor: cache block have state in wishlist
* test: fix `gotBlockResortsPiece`
* fixup! refactor: track active requests in each respective peer
* fixup! test: fix `gotBlockResortsPiece`
* fix: count webseeds when calculating active requests
* build: update xcode project
* fix: add missing `candidates_dirty_` checks
* chore: remove old `depends-on` comments
* fixup! refactor: use bitfield to store active requests per peer
* refactor: extract block peer event to separate function
* perf: reorder conditions by overhead
* perf: check for completed block instead of completed piece
* chore: remove duplicated "unrequested piece" check
* refactor: merge similar block size sanity check
* refactor: use map to store number of requests in wishlist
* refactor: add asserts
* refactor: flush write buffer as soon as there is new data
* refactor: more accurate function naming
* fix: account for corrupt pieces in wishlist
* fix: account for unaligned blocks in wishlist
* Revert "fix: account for unaligned blocks in wishlist"
This reverts commit c3fce93cbae49c11d62e26caccedf55c1987aa95.
* fixup! refactor: use map to store number of requests in wishlist
* fix: account for unaligned blocks in wishlist v2
* chore: add `[[nodiscard]]`
* fixup! fix: account for unaligned blocks in wishlist v2
* fix: crash when handshake finishes in the middle of function
the files web/prettier.config.js and web/stylelint.config.js were renamed in b9f4509, but web/CMakeLists.txt was not updated correspondingly.
hence, using `REBUILD_WEB` would cause FTFS.
`tr_peer_info::reconnect_interval_has_passed()` contains logic to increase the reconnect interval for unreachable peers, but it has no effect at all currently because they wouldn't be tried in the first place.
* refactor: add log warning for ut metadata in private torrent
* refactor: add log warning for ut pex in private torrent
* refactor: add log warning for ltep handshake without advertised support
* refactor: unify ltep handshake log format
* refactor: removed redundant ltep logs
* refactor: add back log for ut pex
* macOS autosize dock fix
* Fix: Move variable declaration inside block to minimize scope length
* Fix: Move comment to its own line for better readability
* Fix: Use dot syntax for accessing scrollViewHeight property in calculateScrollViewHeightWithDockAdjustment method
* Fix: Add CGFloat type declaration for height variable
* rollback alignment change for clang-format
---------
Co-authored-by: emeritaacuity0u <emerita.acuity_0u@icloud.com>
* fix: readability-math-missing-parentheses clang-tidy warnings
* chore: remove unused function tr_ctorGetSession()
* chore: remove unused function tr_ctorGetIncompleteDir()
* chore: make generatePublicKey() a lambda
* fix: readability-container-contains warnings
* fix: misc-use-internal-linkage warnings
* chore: inline generate_public_key() since it was only used once
* fix: update `date_done_` as long as the torrent is done
* fix: `mark_change()` should be called as long as torrent state changes
* chore: remove redundant completeness update in `tr_torrent::start_in_session_thread()`
* fix: log whenever torrent state changes
* chore: add comment to explain `recent_change`
* chore: housekeeping
* fix: recover torrents with missing date done
* fix: only consider peers with listening ports interesting
It's a waste of space to store peers we cannot connect to (because we don't know what their listening port is).
* fix: don't consider peer as interesting just because we are currently connected to it
For example, it's possible for a peer to be "in-use" and "banned" at the same time, albeit just for a very short while.
* code review: assert that peer port is not empty
* Reformat GTK *.ui files
Remove useless comments since we're mostly editing those files by hand
now. Wrap multi-line text values in CDATA to avoid automated formatters
changing whitespace there in any way. Collapse empty elements.
* Switch from plain `GtkLabel`s to `GtkFrame`s for sections
Frames are reported as groupings by assistive technologies.
* Fix minor usability issues
* Make value labels labelled and selectable
* fix: allow connection between seeds when pex is enabled
* chore: add comment to explain `tr_peerMsgs::on_torrent_got_metainfo()`
* refactor: remove `tr_swarm::mark_peer_as_seed()`
* fix: update seed flag in response to BT msgs
Regression from 81a42c6bb6
* chore: remove redundant code to update peer seed flag
* refactor: inc failure count if there were no piece data exchanged
* fix: save information from ltep handshake
* refactor: rename `tr_peerIo::is_seed_` to disambiguate
* fix: add instead of set pex flags when adding non-pex and non-resume peers
* fix: don't mark peer as connectable on getting ltep port msg
By BEP-11's definition, this flag is only set for peers whom we successfully initiated an outgoing connection with.
* refactor: set holepunch flag when we get it from ltep handshake
* fix: only accept positive `reqq` in ltep handshake
* refactor: handle encryption preference in `tr_peer_info`
* refactor: prefer own value for utp support
* refactor: make `tr_peer_info::from_first_` const
* refactor: handle holepunch support in `tr_peer_info`
* fix: parse metadata size only if we have a valid extention id for metadata xfer
* refactor: remove `tr_peer_info::add_pex_flags()` as it's no longer needed
* fix: correctly handle holepunch support when there is no `m` key in ltep handshake
* fix: distinguish between upload only and seed
Say we just connected to a partial seed, the peer sends an ltep handshake that has the `upload_only` key, then a BT `Bitfield` message:
Without this change, the pex seed flag would be set when parsing the ltep handshake, then immediately unset when parsing the `Bitfield` message.
We don't want that.
* fix: don't update `tr_peer_info::is_seed_` when merging peer info objects
* perf: priority in peer candidate score need 2 bits only
* fix: prefer to connect to downloading peers
Regression from c867f00153
* chore: add TODO for C++20 opportunity
* refactor: don't filter out peers without `ADDED_F_CONNECTABLE`
revert change from a2849219f7
* refactor: move peer state updates out of peermgr code
---------
Co-authored-by: Charles Kerr <charles@charleskerr.com>