Commit Graph

91 Commits

Author SHA1 Message Date
Charles Kerr 7c87cb36eb
refactor: tr_torrent_metainfo (#2340)
* refactor: add tr_torrent_metainfo class

Can be used for parsing bencoded .torrent data without instantiating
a tr_torrent. This will be used in all the places where client code
needs to test a .torrent file for validity / to add a preview window
before adding the torrent.
2021-12-25 15:21:13 -06:00
Charles Kerr b058daff4b
refactor: change tr_torrentNew() args (#2337) 2021-12-24 16:05:17 -06:00
Charles Kerr f3228e9670
refactor: further decouple tr_torrent and tr_info (#2336) 2021-12-24 15:12:33 -06:00
Charles Kerr dd1379b0b6
refactor: add tr_interned_string (#2332) 2021-12-23 11:16:05 -06:00
Charles Kerr bd68d3a2fd
refactor: use tr_sha1_digest_t everywhere (#2330) 2021-12-21 16:14:15 -06:00
Charles Kerr 37a8046ed5
fix: more sonarcloud warnings (#2324) 2021-12-16 23:47:51 -06:00
Charles Kerr b9406dfebb
refactor: even more torrent housekeeping (#2323) 2021-12-16 22:51:53 -06:00
Charles Kerr e4a172d39c
fix: sonarcloud (#2322)
* fix: sonarcloud warning - redundant cast

* fix: sonarcloud warning - init-statement

* fix: sonarcloud warning - init-statement

* fix: sonarcloud warning - move #include to top of file

* fix: sonarcloud warning - implicit conversion loses precision

* fix: sonarcloud warning - confirm safe use of strlen

* fix: sonarcloud warning - refactor code to not nest more than three deep

* iwyu: cstring

* iwyu: algorithm
2021-12-16 16:58:58 -06:00
Charles Kerr b93f3f0463
refactor: more tr_torrent housekeeping (#2320) 2021-12-16 03:43:51 -06:00
Charles Kerr 4ea2429217
refactor: tr_torrent housekeeping (#2319) 2021-12-16 02:49:04 -06:00
Charles Kerr e65e0b3caa
refactor: prefer tr_strv*() even more (#2318) 2021-12-15 23:16:40 -06:00
Charles Kerr 2277fde4e0
refactor: prefer tr_strv*() funcs (#2317) 2021-12-15 20:09:46 -06:00
Charles Kerr 42b1362760
refactor: tidy libtransmission includes (#2316) 2021-12-15 15:25:42 -06:00
Charles Kerr 1c848cf174
refactor: add tr_info accessors to tr_torrent (#2314)
* refactor: add tr_info accessors to tr_torrent
2021-12-15 09:53:20 -06:00
Charles Kerr d00be0dec7
refactor: tr_torrentIsSeed() -> tr_torrent::isDone() (#2313) 2021-12-15 01:04:26 -06:00
Charles Kerr 68518bc307
refactor: make some tr_torrentFoo() methods member functions (#2312) 2021-12-14 23:48:56 -06:00
Charles Kerr 1e20d676c1
refactor: make tr_torrentInfo() private (#2285)
* refactor: make tr_torrentInfo() private
2021-12-14 15:59:44 -06:00
Charles Kerr 656df477f2
refactor: add tr_announce_list (#2308)
* refactor: add tr_announce_list (#2308)
2021-12-14 14:59:40 -06:00
Charles Kerr cec7685a64
refactor: remove unused tr_torrent.dnd_pieces_ (#2296) 2021-12-09 20:54:44 -06:00
Charles Kerr 0cedfec630
fixup! refactor: add tr_torrentTrackers() (#2282) (#2294)
ensure announcer tracker count is correct
2021-12-09 20:03:26 -06:00
Charles Kerr f39a1e45a8
fix: crash in tr_file_priorities::filePriority() (#2291)
Fixes #2262.
2021-12-09 15:38:18 -06:00
Charles Kerr d5aead4b41
fix: non-portable strftime format string (#2290)
Xref: b61b1e2c16
2021-12-09 14:30:39 -06:00
Charles Kerr b9de5bb9ca
fixup! fix: env var leak in tr_spawn_async() (#2212) (#2289)
fix: fmr error with temporary strings
2021-12-09 12:39:06 -06:00
Charles Kerr ab0c49859e
refactor: add tr_torrentTrackers() (#2282)
* refactor: add tr_torrentTrackers()
2021-12-08 10:55:52 -06:00
Charles Kerr c46ce2da06
refactor: add tr_torrentWebseed(), tr_torrentWebseedCount() (#2277)
* refactor: add tr_torrentWebseedCount()
2021-12-07 12:11:28 -06:00
Charles Kerr 5096bbae9b
refactor: add tr_torrent::file() (#2274)
* refactor: add tr_torrent::fileCount()
2021-12-06 22:18:17 -06:00
Charles Kerr 867a131e1d
refactor: add tr_torrent::fileCount() (#2273)
Provide an accessor to get a torrent's file count.

This is an incremental step towards making tr_torrent's impl private.
2021-12-06 15:26:04 -06:00
Charles Kerr c656bee061
refactor: add tr_saveFile() (#2267)
* refactor: add tr_saveFile()

* refactor: add tr_ctorSaveContents()
2021-12-04 19:32:35 -06:00
Charles Kerr 35fe175f2a
refactor: add file-piece-map (#2246)
* refactor: add file-piece-map

* refactor: use tr_file_priorities

* refactor: use tr_files_wanted
2021-11-28 19:12:54 -06:00
Charles Kerr 34881f6295
refactor: make parts of tr file private (#2241)
* refactor: make parts of tr_file private
2021-11-27 21:17:47 -06:00
Charles Kerr f6f0db75e1
fix: sonarcloud warnings / code smells (#2242)
* fix: use-init-statement

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1f6EvHJiycnfA7gfrG\&open\=AX1f6EvHJiycnfA7gfrG

* fix replace-use-of-new warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs41ZmlvCveKTzon\&open\=AX1ZNs41ZmlvCveKTzon

* fix has-virtual-functions-but-non-virtual-destructor warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs72ZmlvCveKTzo6\&open\=AX1ZNs72ZmlvCveKTzo6

* fix make-variable-const warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0_a_OVNJn7rAzml_7B\&open\=AX0_a_OVNJn7rAzml_7B

* fix remove-redundant-static-specifiers

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTb\&open\=AX06St-81usi2gyYkPTb

* fix function-should-be-declared-const

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTd\&open\=AX06St-81usi2gyYkPTd

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTc\&open\=AX06St-81usi2gyYkPTc

* fix class-has-virtual-functions-but-non-virtual-destructor warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stz41usi2gyYkPTS\&open\=AX06Stz41usi2gyYkPTS

* fix remove-commented-out-code warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTT\&open\=AX06St241usi2gyYkPTT

* fix remove-commented-out-code warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTV\&open\=AX06St241usi2gyYkPTV

* fix has-virtual-functions-but-non-virtual-destructor warning

https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTW\&open\=AX06St241usi2gyYkPTW

* fix remove-commented-out-code warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06SuCA1usi2gyYkPTh\&open\=AX06SuCA1usi2gyYkPTh

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rAQvnfJ-O-YIDS9xF\&open\=AX0rAQvnfJ-O-YIDS9xF

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rAQvnfJ-O-YIDS9xG\&open\=AX0rAQvnfJ-O-YIDS9xG

* fix remove-redundant-access-specifier warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs5tZmlvCveKTzor\&open\=AX1ZNs5tZmlvCveKTzor

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX01Itl7f_SST5i7BN1l\&open\=AX01Itl7f_SST5i7BN1l

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0wDijI2l89lDvp1C9P\&open\=AX0wDijI2l89lDvp1C9P

* fix use-automatically-managed-memory-instead-of-new warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1f6E6HJiycnfA7gfrI\&open\=AX1f6E6HJiycnfA7gfrI

* fix use-init-statement warning

Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0l8vknEafnvRiIHUEv\&open\=AX0l8vknEafnvRiIHUEv

* fixup! fix has-virtual-functions-but-non-virtual-destructor warning
2021-11-27 19:58:35 -06:00
Charles Kerr 742ae6fb00
refactor: minor naming change in block_info (#2233)
* refactor: rename method as block_info.pieceSize()

* refactor: rename method as block_info.blockSize()
2021-11-26 13:33:56 -06:00
Charles Kerr dc36787378
fix: coverity warnings (#2229)
* fix: coverity uninitialized member warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204371746\&defectInstanceId\=52288281\&mergedDefectId\=1494442\&eventId\=52288281-41

* fix: coverity uninitialized member warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204371746\&defectInstanceId\=52288281\&mergedDefectId\=1494442\&eventId\=52288281-43

* fix: coverity unchecked return value

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204371760\&defectInstanceId\=52254984\&mergedDefectId\=1494150

* fix: coverity false nullptr dereference warning

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204369613\&defectInstanceId\=52254971\&mergedDefectId\=1493396

* fix: coverity unchecked return value

Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204369625\&defectInstanceId\=52288288\&mergedDefectId\=1491891
2021-11-25 18:14:25 -06:00
Charles Kerr 72cae4996f
fixup! refactor: tr_completion (#2220) (#2228)
fix off-by-one
2021-11-25 16:13:21 -06:00
Charles Kerr de169c7ec3
refactor: tr_completion (#2220)
* refactor: refactor tr_completion + add test coverage for it
2021-11-25 12:26:51 -06:00
Charles Kerr 68e3820ed1
fixup: crash after completing magnet link metainfo (#2215) 2021-11-24 14:12:32 -06:00
Charles Kerr dbd9130d9d
fix: env var leak in tr_spawn_async() (#2212)
* fix: env var leak in tr_spawn_async()
2021-11-24 13:25:23 -06:00
Charles Kerr 843e486d2a
refactor: tr_block_info class (#2210)
* refactor: add tr_block_info with tests
2021-11-24 08:48:52 -06:00
Charles Kerr da855a7257
refactor: use std mutex/lock intead of bespoke (#2194)
* refactor: use std mutex/lock intead of bespoke
2021-11-20 15:20:45 -06:00
Charles Kerr 073c6af1d6
refactor: swarm (#2103)
* refactor: encapsulate request tracking in a class

Introduces a new class to peer-mgr, `ClientRequests`, which tracks what
active requests we've got pending: which blocks, when the requests were
sent, and who they were sent to.

This shouldn't change peer-mgr behavior. Its goal is to carve out some
of peer-mgr's data structures and encapsulte them behind an API that's
simpler to understand.

* refactor: move ActiveRequests to its own file

* perf: avoid duplicate call to tr_cpMissingBlocksInPiece
2021-11-19 12:37:38 -06:00
Charles Kerr b3e4fc64c5
perf: faster shutdown (#2193)
* perf: don't update queue positions during shutdown

When a torrent is being removed, we try to update the queue positions of
the other torrents. But it's (slightly) expensive and is irrelevant when
the session is closing, so skip it in that case.

* perf: torrentLoadResume shouldn't touch tor->dirty

Loading torrent settings from disk does call a lot of tr_torrentSetFoo()
functions, but since these are the saved settings, they shouldnt' affect
the torrent's 'is dirty' flag.
2021-11-18 12:19:55 -06:00
Charles Kerr a79a868257
refactor: make tr_variantFromBuf() public (#2187)
* refactor: add tr_variantFromBuf() and support inplace json/benc parsing
2021-11-17 23:37:35 -06:00
Charles Kerr a21594b0ce
refactor: add tr_torrent::renamePath (#2178) 2021-11-15 22:10:36 -06:00
Charles Kerr 505d2ae428
refactor: tr_torrent.setLocation (#2175)
member version of tr_torrentSetLocation
2021-11-15 14:53:53 -06:00
Charles Kerr 254d837ddf
fixup! refactor: make piece checksums private (#2130) (#2136) 2021-11-13 00:53:52 -06:00
Charles Kerr 6571be2b95
feat: add tr_strvPath() (#2134)
* feat: add tr_strvJoin

* feat: add tr_strvPath
2021-11-12 18:10:04 -06:00
Charles Kerr d1f8c28fcd
refactor: make piece checksums private (#2130)
* refactor: remove tr_info.pieces
2021-11-12 10:42:51 -06:00
Charles Kerr 7693ef69bf
refactor: magnet metainfo (#2124)
* refactor: magnet-metainfo
2021-11-09 20:42:18 -06:00
Charles Kerr bdf1bb6d17
refactor: tr_strv*() util functions (#2123)
* feat: add tr_strv utils
2021-11-09 18:13:47 -06:00
Charles Kerr d8b57fe4dc
refactor: web_utils (#2121)
* chore: move web utils from web, utils to web-utils
2021-11-08 21:30:03 -06:00