1
0
mirror of https://github.com/veggiedefender/torrent-client.git synced 2025-11-06 09:29:16 +02:00
Commit Graph

71 Commits

Author SHA1 Message Date
Jesse Li
b3ee9f4117 Use clearer names for functions that send messages 2020-01-02 12:23:22 -05:00
Jesse Li
b255ecc574 Fix torrentfile TestOpen 2020-01-02 12:20:41 -05:00
Jesse Li
b3299a6bfa Simplify download interface 2020-01-02 12:17:45 -05:00
Jesse Li
06b849a44d Fix bug which produced incorrect piece size 2020-01-02 11:49:08 -05:00
Jesse Li
873008bb96 Caveat that Download stores the file in memory 2020-01-02 10:51:13 -05:00
Jesse Li
22fc59dae3 Small refactor of downloadState
Renames the struct to pieceProgress and makes readMessage/readMessages
methods of the struct instead of arguments, to make it a little bit
clearer that they modify the struct in-place.
2020-01-02 10:47:02 -05:00
Jesse Li
d4f6d1265d Check error in request to client 2020-01-02 10:44:08 -05:00
Jesse Li
70713e028d Fix race condition
The download loop might finish and kill the worker goroutine before it's
done sending HAVE messages. Switching the order of these two lines
trivially fixes the issue (but it's still brittle)
2020-01-02 10:41:24 -05:00
Jesse Li
73a9a5216b Break p2p.Peer and parsePeers into its own package 2020-01-02 10:39:35 -05:00
Jesse Li
25810161eb Add timeout to tracker GET request 2020-01-02 10:34:47 -05:00
Jesse Li
17e57b6dd6 Rename getPeers to requestPeers 2020-01-02 10:32:20 -05:00
Jesse Li
cc088e8b79 Only use fmt.Errorf 2020-01-02 10:30:30 -05:00
Jesse Li
4f6a2eb20e Make peerSize a const 2020-01-02 10:28:58 -05:00
Jesse Li
4fd40f9f0a Return plain struct from toTorrentFile 2020-01-02 10:27:00 -05:00
Jesse Li
7e8b3413ac Check error in getPeers 2020-01-02 10:23:18 -05:00
Jesse Li
f746beb9d6 Remove log in torrentfile 2020-01-02 10:22:52 -05:00
Jesse Li
9c6bf79e61 Rename toTorrent to toTorrentFile 2019-12-31 23:36:27 -05:00
Jesse Li
acd4fe9c62 Implement golden file test for torrentfile.Open 2019-12-31 12:18:18 -05:00
Jesse Li
a5e2137e37 Update README.md 2019-12-30 10:56:35 -05:00
Jesse
487337a08a Add bounds checking to bitfield
This way, we don't panic when we get an invalid HAVE message
2019-12-30 10:34:43 -05:00
Jesse
402e4e1665 Correct the size of a piece
Previously confused piece vs block
2019-12-30 10:23:15 -05:00
Jesse
928bbfeab4 Simplify download algorithm 2019-12-30 10:21:26 -05:00
Jesse
46b55339aa Fix unit in comment about block size 2019-12-29 22:47:32 -05:00
Jesse
23f3a144af Add logging around tracker and number of peers 2019-12-29 21:59:33 -05:00
Jesse
67066ad77c Set 30 second deadline for pieces to download 2019-12-29 21:44:07 -05:00
Jesse
c4fbd50021 Make MaxBlockSize and MaxBacklog public 2019-12-29 20:59:10 -05:00
Jesse Li
92974b393a Update README.md 2019-12-29 20:54:51 -05:00
Jesse Li
6d7c786022 Create LICENSE 2019-12-29 20:47:44 -05:00
Jesse
648d87a2d0 Comments for bitfield SetPiece test cases 2019-12-29 20:44:11 -05:00
Jesse
3b7eb1da70 Separate bitfield into its own package 2019-12-29 20:24:06 -05:00
Jesse Li
353d112e4d Create README.md 2019-12-29 20:08:03 -05:00
Jesse
43d771aa0d Remove commented out code 2019-12-29 19:56:06 -05:00
Jesse
5a57bde05a Use slightly more correct handling of choking 2019-12-29 19:51:17 -05:00
Jesse
a8274e966b Add go mod files 2019-12-29 19:36:24 -05:00
Jesse
97dbe49f57 Increase backlog to 5 2019-12-29 19:32:44 -05:00
Jesse
97f2be0747 Reorder algorithm steps 2019-12-29 19:26:57 -05:00
Jesse
0a5176e4ee Decrease backlog 2019-12-29 19:14:44 -05:00
Jesse
ff89aa406c Cleaner algorithm for downloading piece 2019-12-29 19:06:45 -05:00
Jesse
dced33b933 Report more accurate count of workers 2019-12-29 15:15:53 -05:00
Jesse
ffa8c82919 Rename downloadWorker to startDownloadWorker 2019-12-29 15:12:20 -05:00
Jesse
738af57ef1 Move big switch into a function 2019-12-29 15:06:17 -05:00
Jesse
9d7ddbc62c Refactor p2p 2019-12-29 14:04:36 -05:00
Jesse
d7d46ab7ef Finishes download 2019-12-27 14:33:03 -05:00
Jesse
06fab65638 Pipeline 5 requests at a time 2019-12-27 12:30:20 -05:00
Jesse
7e8cac2d3e Incredibly messy and slow download 2019-12-26 21:53:11 -05:00
Jesse
b1fc8c7fb8 Add p2p client 2019-12-26 17:04:32 -05:00
Jesse
5201cfc0b4 Shorten Message.String() output 2019-12-26 11:21:14 -05:00
Jesse
f2768fefd6 Implement testing membership in bitfield 2019-12-25 23:10:26 -05:00
Jesse Li
f9a22a6d9f Add timeout mechanism 2019-12-24 13:26:09 -05:00
Jesse Li
415666a020 Implement handshake.New() 2019-12-24 11:05:22 -05:00