2
0
mirror of synced 2025-02-24 06:38:14 +00:00

260 Commits

Author SHA1 Message Date
Matt Joiner
53be473486 Track concurrent chunk writes 2019-06-13 12:18:24 +10:00
Matt Joiner
20de43a42c Panic on chunk write errors
The torrent client will download indefinitely when this occurs, a strategy to handle or raise the error more appropriately is required.
2019-03-11 10:46:06 +11:00
Matt Joiner
f1e4840959 Avoid allocating a slice when iterating pending chunks 2019-02-19 14:41:52 +11:00
Matt Joiner
ee5a941203 Switch entirely to anacrolix/log 2019-01-15 18:18:30 +00:00
Matt Joiner
d9e1ebde70 Improve network handling and only listen networks we will use
Fixes #290.
2018-11-28 10:30:21 +11:00
Matt Joiner
1dc406c81c Move IpPort to missinggo 2018-11-16 10:35:30 +11:00
Matt Joiner
148bb977bc connection.remoteIpPort is correct 2018-11-04 21:15:51 +11:00
Matt Joiner
0032b45a02 Store remoteAddr with each connection
It would appear net.Conns returned from proxies don't have a RemoteAddr the client expects.
2018-11-04 21:15:51 +11:00
Matt Joiner
fc4fab91f5 Switch to goimports import sorting
Used to use sortimports, but it's old, and goimports seems to have an opinion now.
2018-11-02 23:12:01 +11:00
Matt Joiner
3ffacb117f Improve log message 2018-08-08 11:26:00 +10:00
Matt Joiner
6dd3b9c12c Law of Demeter Client.mu 2018-07-25 13:42:28 +10:00
Matt Joiner
d575877a5d Wake connections that could send a request for a deleted piece
I'm not sure this is entirely correct, but not doing it is probably less correct. It should help prevent stalls where writers aren't requesting because they're starved out of opportunities by other connections.
2018-07-17 21:29:54 +10:00
Matt Joiner
6d6197b0a1 Switch pieceIndex back to an int
I suspect that interface conversions using packet iter are causing a lot of allocation. Either way, with the casting this adds, we should be able to change pieceIndex's type alias now with minimal code change.
2018-07-17 21:28:01 +10:00
Matt Joiner
216cb7e356 Don't randomize chunk order for requestStrategy 3
This should also reduce a lot of allocation.
2018-07-17 15:08:46 +10:00
Matt Joiner
5fb5010762 Fix connection.utp 2018-07-15 12:55:49 +10:00
Matt Joiner
324cc7a281 Comments and trivial tweaks 2018-07-12 09:42:00 +10:00
Matt Joiner
f5bd377941 Change pieceIndex to peer_protocol.Integer 2018-07-12 09:15:15 +10:00
Matt Joiner
b9cfe71d90 Remove debug log 2018-07-10 13:14:39 +10:00
Matt Joiner
1f6ba94882 Make extended handshake a struct, and move a bunch of extended stuff into peer_protocol 2018-07-10 12:20:36 +10:00
Matt Joiner
50def7a688 Move PEX stuff into peer_protocol 2018-07-10 11:21:24 +10:00
Matt Joiner
ba9935d522 Add more worseConn comparisons
Should fix #264.
2018-07-10 09:50:39 +10:00
Matt Joiner
fad06c7ddf sortimports 2018-07-07 11:36:58 +10:00
Matt Joiner
e0f0617b0b Comments and readability 2018-07-07 11:33:48 +10:00
Matt Joiner
76a3c0891a Expose handshake stuff in peer_protocol 2018-07-07 11:31:29 +10:00
Matt Joiner
15f3c822c5 Assume connections have half the download bandwidth than calculated 2018-06-30 21:10:23 +10:00
Matt Joiner
b2117bc571 Use timers for duplicate requests
Nothing was triggering request updates when timeouts expired. This is the simplest fix, no performance considered.
2018-06-30 00:10:31 +10:00
Matt Joiner
a3bc6398c8 Merge messageTypes{Sent,Posted} into torrent expvar 2018-06-29 22:10:21 +10:00
Matt Joiner
7b924822c7 Fix panic in connection.iterPendingPieces when the info isn't available
Triggered by connection.iterUnbiasedPieceRequestOrder calling Torrent.numPieces. We shouldn't be iterating pieces when there's no info anyway, so don't yield any. Mentioned in https://github.com/anacrolix/torrent/issues/253#issuecomment-400350386.
2018-06-28 11:12:49 +10:00
Matt Joiner
6212973011 Add more context to an error 2018-06-26 20:24:39 +10:00
Matt Joiner
c921242f30 Do requests synchronously, and don't request from hashing or queued pieces
Calculating the desired state was a nice idea, but too hard to debug. This way should also be faster.
2018-06-26 14:51:55 +10:00
Matt Joiner
7dd532d46f Check that chunks we request aren't being hashed or queued for hash 2018-06-26 13:04:15 +10:00
Matt Joiner
85dc3c204a Rework stats for receiving chunks
Related to #253.
2018-06-25 14:06:30 +10:00
Matt Joiner
0330b87288 Drop connections that send chunks we shouldn't receive 2018-06-24 20:35:46 +10:00
Matt Joiner
195695042d Add requestStrategy 3, which duplicates requests only after a timeout
Possible solution for #253.
2018-06-24 20:04:31 +10:00
Matt Joiner
d2602c7935 Write received chunks that we don't have
Chunks were discarded if they belong to unprioritized pieces, even if those pieces were previously prioritized. May be contributing to #253.
2018-06-24 19:40:53 +10:00
Matt Joiner
ad03e64722 Retain interest if requests are outstanding and don't clear peer requests if they send not_interested
Apparent shortcomings found when trying new request algorithms.
2018-06-23 22:32:11 +10:00
Matt Joiner
159c4a0e28 Ensure 64-bit alignment of ConnStats fields
Fixes #262.
2018-06-23 18:33:56 +10:00
Matt Joiner
3a17708c78 Move chunk expvars into torrent prefix 2018-06-17 16:18:22 +10:00
Matt Joiner
4c471be802 Add connection.hasPreferredNetworkOver and friends 2018-06-16 17:14:47 +10:00
Matt Joiner
7a5aa2c42f Fix some formatting of ConnStats fields 2018-06-16 17:10:56 +10:00
Matt Joiner
174120e1e8 Rework Torrent pending requests assertions
Should provide more info, and sooner for #249.
2018-06-16 17:00:50 +10:00
Matt Joiner
e97f487d2e Rename Config->ClientConfig and change how defaults work
This is a very breaking change.
2018-06-16 16:30:04 +10:00
Matt Joiner
360e1dbdd1 Track ConnStats with atomics 2018-06-12 20:21:53 +10:00
Matt Joiner
cea5584d6b Track outgoing through a new field on connection, and rework duplicate connection preferencing 2018-06-12 20:14:00 +10:00
Matt Joiner
ac6ba9f021 Add ConnStats at Client level
ConnStats management is refactored to make this less tedious.
2018-06-10 09:20:33 +10:00
Matt Joiner
3d680f8afc Update a link 2018-06-10 09:20:33 +10:00
Matt Joiner
9928914ecd Add some peer source comments 2018-04-12 15:12:29 +10:00
Matt Joiner
319e57d1c6 Rework conns to/and allow multiple DHT servers
This will help with #229, and IPv6 support.
2018-04-12 11:41:07 +10:00
Matt Joiner
646622b8f1 Move clamp and max, and add min to misc.go 2018-02-16 12:14:15 +11:00
Matt Joiner
066cdd520b Add mse.CryptoMethod type 2018-02-16 10:36:29 +11:00