YenForYang
134eea8418
Fix usages of eachListener() and make inlineable ( #599 )
2021-09-13 21:35:51 +10:00
YenForYang
52e8c82999
Inlineable methods to access File piecePriority ( #601 )
2021-09-13 21:17:54 +10:00
YenForYang
5c440e8929
Simplify (*Torrent).gotMetainfo ( #581 )
2021-09-13 11:41:11 +10:00
YenForYang
1bb6724020
Remove xerrors dependency ( #600 )
...
* Remove xerrors dependency
* Update main.go
2021-09-13 11:38:08 +10:00
YenForYang
3b4d4a64ff
Reorder fields to reduce padding in reader ( #597 )
...
Reorder some of the fields to reduce the size of `reader`. Not much of a change -- original size was 104 bytes, with changes (moving bool's to the end) the size is 96 bytes. There's also the whole cache-friendly bit -- I tried reordering fields to help here, but I doubt it makes much of a difference.
Some other notes: `sync.Locker` is a 16 byte field. I suggest changing this to something like `*sync.RWMutex` or `*lockWithDeferreds`. This would not only reduce size but would allow access to `RLock`/`RUnlock`.
`pieceRange` could also be shrunk to 8 bytes, but I feel like I'm probably asking for too much lol.
2021-09-13 11:36:35 +10:00
YenForYang
4691b0b8d1
Update ReadCloser interface check to ReadSeekCloser ( #595 )
2021-09-12 14:14:07 +10:00
Matt Joiner
a9cbb644c5
Fix http announce of infohash containing ' ' bytes ( #591 )
...
Fixes https://github.com/anacrolix/torrent/issues/534 .
2021-09-12 14:11:59 +10:00
Matt Joiner
79ad5e4676
Don't call Client onClose handlers until torrent storages are closed
2021-09-11 11:39:33 +10:00
Matt Joiner
7378d50a3c
Fix Torrent.Drop to wait for storage close without client lock
2021-09-11 11:39:33 +10:00
YenForYang
d957502528
Avoid allocating memory when checking interface ( #588 )
...
Not a big deal, but there isn't a need to allocate an object to check that `*Node` satisfies `bencode.Unmarshaler`.
2021-09-11 08:26:43 +10:00
Matt Joiner
6c9a7fec39
Optimize peersForPieces allocations for make and sorting
2021-09-10 23:07:10 +10:00
Matt Joiner
c4445fd201
Optimize requesting peerId Uintptr allocation
2021-09-10 23:07:10 +10:00
Matt Joiner
e9193968a3
Disable ensureValidSortedPeersForPieceRequests
...
Should approximately half the contribution of the parent function to overhead.
2021-09-10 23:07:10 +10:00
Matt Joiner
016bf1b07c
Optimize sortPeersForPiece in allocatePendingChunks
2021-09-10 23:07:10 +10:00
Matt Joiner
0d10a1b53a
Optimize Torrent.worstBadConn
2021-09-10 23:07:10 +10:00
Matt Joiner
1ef51e7840
Remove reader.opMu
...
https://github.com/anacrolix/torrent/issues/553
2021-09-10 23:07:10 +10:00
Matt Joiner
35064425eb
go fmt ./...
2021-09-09 22:51:24 +10:00
Matt Joiner
5cb47021ac
Fix possible misuse of reflect.StringHeader
2021-09-09 22:49:22 +10:00
YenForYang
1fc6093383
useTorrentSources: fix http request resource leak ( #562 )
2021-09-09 22:39:12 +10:00
YenForYang
62c6fbc8f8
Clarify ownership of (*Torrent).chunkPool ( #583 )
...
Basically bind the lifetime of chunkPool to the torrent by using `sync.Pool` in lieu of `*sync.Pool`. Gives the GC ever so slightly less work to do.
2021-09-09 22:27:16 +10:00
Matt Joiner
10d5e6234e
Don't readahead until a read occurs
2021-09-09 22:19:48 +10:00
Matt Joiner
58483ae399
Make readahead algorithm linear
2021-09-09 22:19:48 +10:00
Matt Joiner
e8b496bee6
Add default sqrt readahead algorithm
2021-09-09 22:19:48 +10:00
Matt Joiner
4912ae2781
Extract common Torrent.newReader
2021-09-09 22:19:48 +10:00
Matt Joiner
3c95512f23
Add Webtor to downstream projects
2021-09-09 22:12:29 +10:00
Matt Joiner
151bf9ea68
Fix unit tests littering working directory
2021-09-09 12:58:07 +10:00
Matt Joiner
128ac28c02
Update README.md
2021-09-08 13:46:03 +10:00
Matt Joiner
6d560b8902
Update README.md
2021-09-08 13:45:25 +10:00
YenForYang
719505a138
Drop xerrors and missinggo/slices dependency for Client ( #572 )
...
* Drop xerrors and missinggo/slices dependency for Client
Made `BadPeerIPs` inlineable since I changed `badPeerIPsLocked` anyway. Also eliminated an extra torrentsAsSlice copy since Go wasn't smart enough to figure it out.
2021-09-08 09:34:06 +10:00
Zilog8
ccb90f1252
Improve Closing ( #559 )
...
- Prevent double-closing in cmd/torrent
- Move async closing from storage to torrents, and wait on them to finish tidying up before returning/exiting.
2021-09-05 11:33:41 +10:00
Matt Joiner
f295057347
Update chansync
2021-09-04 23:34:06 +10:00
Matt Joiner
ad70dcdbf4
Return error on sqlite PieceCompletion.Set when closed
2021-09-04 23:07:32 +10:00
Matt Joiner
175b826e73
Rework Reader waiting
2021-09-04 23:07:32 +10:00
YenForYang
f86355ac0b
Simplify dhtPort()
...
A similar case of `haveDhtServer`
2021-09-04 23:04:06 +10:00
YenForYang
99ba75f458
Drop xerrors and reflection dependency
...
Nothing wrong with missinggo.CopyExact -- but fewer dependencies is better IMO. Also changed String() to use a consistent receiver name -- not a big deal.
2021-09-04 23:01:37 +10:00
afjoseph
c76bb42c07
[gomod] Update anacrolix/dht and run 'go mod tidy'
2021-09-04 21:21:52 +10:00
YenForYang
d1c0b95a9c
Simplify haveDhtServers()
...
A bit too much functional programming, lol.
2021-09-03 20:41:01 +10:00
Matt Joiner
d4c3a690ab
Merge branch 'master' into squirrel
2021-09-02 14:19:29 +10:00
Matt Joiner
30e8d1ae74
go get -u ./...
2021-09-02 10:31:47 +10:00
Matt Joiner
b4a66a3ca7
Add generics TODO
2021-09-02 10:22:32 +10:00
Matt Joiner
e417c19a74
Add "no name" handling and storage.NewFileOpts
...
This came out of testing against Transmission in https://github.com/anacrolix/torrent/discussions/556#discussioncomment-1263670 .
2021-09-02 10:22:32 +10:00
Matt Joiner
d8a6509728
./cmd/torrent-create: Update the builtin announce list
2021-09-02 10:22:32 +10:00
Matt Joiner
aa3b864426
Fix info name when building from . and ..
2021-09-02 10:22:32 +10:00
Matt Joiner
62911fd656
cmd/torrent download: Don't seed if no torrents are specified
2021-09-02 10:22:32 +10:00
Matt Joiner
23029571ec
Fix panic on double Close of sqlite piece completion DB
2021-09-02 10:22:32 +10:00
YenForYang
cce8c150c2
PieceStateRuns: reduce copying and make inlineable
...
Just a heads up: using `range` and/or `defer` prevents function inlining. This is fine for infrequently called functions and/or large functions, but for simple public methods like these, I'd assume it's better for them to be inlined.
2021-09-01 14:51:45 +10:00
Matt Joiner
bf6e64a652
Fix some DeepSource lints
2021-08-30 11:48:34 +10:00
Matt Joiner
a0ec0f2708
Set Go CI workflow to use Go 1.17
2021-08-30 11:19:16 +10:00
Matt Joiner
f838cda49f
go mod tidy
2021-08-26 11:20:52 +10:00
Matt Joiner
cf6c20d306
Add function to wrap squirrel.Cache as storage.ClientImpl
2021-08-26 11:20:37 +10:00