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

41 Commits

Author SHA1 Message Date
Jesse Li
2768f3ea3d Remove buffering from results channel 2020-01-04 11:01:01 -05:00
Jesse Li
b59125b5b7 Rip out reader code 2020-01-02 19:36:25 -05:00
Jesse Li
e9edc62c57 Split client into its own package 2020-01-02 15:34:25 -05:00
Jesse Li
b3beb5ed2a Check infohash in handshake 2020-01-02 12:26:54 -05:00
Jesse Li
b3ee9f4117 Use clearer names for functions that send messages 2020-01-02 12:23:22 -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
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
3b7eb1da70 Separate bitfield into its own package 2019-12-29 20:24:06 -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
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 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
Jesse Li
c20965ebf5 Move handshake into its own package 2019-12-24 10:42:47 -05:00
Jesse Li
aa8ef0ed76 Close connection after handling error
Fixes segfault when connection refused
2019-12-24 10:19:43 -05:00
Jesse
cdfb02a591 Implement formatting requests and parsing pieces 2019-12-23 12:58:23 -05:00
Jesse
7999e23fe1 Super janky download first piece 2019-12-22 23:51:31 -05:00
Jesse
12fac89ce5 Remove PieceLength from Downloader struct 2019-12-22 22:37:27 -05:00
Jesse
519d64fa9a Stub out p2p interface 2019-12-22 22:25:57 -05:00
Jesse Li
2810320046 Receive handshake from peer! 2019-12-22 17:43:39 -05:00