libeech, branch HEAD bittorrent library 7e8d4120ee59ab30c1ebb9e3b42d324fd6136eec 2020-03-25T10:46:31Z 2020-03-25T10:47:04Z Restrict sending pieces to peers interested and not choking Willy Goiffon dev@z3bra.org commit 7e8d4120ee59ab30c1ebb9e3b42d324fd6136eec parent c6bbaeb81ecc0d3493a3787971508b5d0a94132f Author: Willy Goiffon <dev@z3bra.org> Date: Wed, 25 Mar 2020 11:46:31 +0100 Restrict sending pieces to peers interested and not choking c6bbaeb81ecc0d3493a3787971508b5d0a94132f 2020-03-25T10:38:01Z 2020-03-25T10:38:01Z Move getinetaddr() to util.c Willy Goiffon dev@z3bra.org commit c6bbaeb81ecc0d3493a3787971508b5d0a94132f parent 981d390989a1c9f78eccad8da43cf1cb3c7a6c42 Author: Willy Goiffon <dev@z3bra.org> Date: Wed, 25 Mar 2020 11:38:01 +0100 Move getinetaddr() to util.c 981d390989a1c9f78eccad8da43cf1cb3c7a6c42 2020-03-24T12:32:15Z 2020-03-24T12:32:15Z Add functions to bind on local port Willy Goiffon dev@z3bra.org commit 981d390989a1c9f78eccad8da43cf1cb3c7a6c42 parent 8afdae6d82a60416d382d93de7d59d18b5adb488 Author: Willy Goiffon <dev@z3bra.org> Date: Tue, 24 Mar 2020 13:32:15 +0100 Add functions to bind on local port 8afdae6d82a60416d382d93de7d59d18b5adb488 2020-03-24T11:53:49Z 2020-03-24T11:53:49Z Merge hsrecv() and pwprecv() together Willy Goiffon dev@z3bra.org commit 8afdae6d82a60416d382d93de7d59d18b5adb488 parent 93a726cdb20ad6b3b46f0cda4d7436cc262f5d9f Author: Willy Goiffon <dev@z3bra.org> Date: Tue, 24 Mar 2020 12:53:49 +0100 Merge hsrecv() and pwprecv() together 93a726cdb20ad6b3b46f0cda4d7436cc262f5d9f 2020-03-24T11:52:52Z 2020-03-24T11:52:52Z Cleanup code / remove useless "static" keywords Willy Goiffon dev@z3bra.org commit 93a726cdb20ad6b3b46f0cda4d7436cc262f5d9f parent 1caf6fccd437de0e14100d0138163ee20003750a Author: Willy Goiffon <dev@z3bra.org> Date: Tue, 24 Mar 2020 12:52:52 +0100 Cleanup code / remove useless "static" keywords 1caf6fccd437de0e14100d0138163ee20003750a 2020-03-24T10:18:42Z 2020-03-24T10:18:42Z Immediately send piece upon REQUEST Willy Goiffon dev@z3bra.org commit 1caf6fccd437de0e14100d0138163ee20003750a parent 3698a0b5554fca72a59bbad6d7942387a168071b Author: Willy Goiffon <dev@z3bra.org> Date: Tue, 24 Mar 2020 11:18:42 +0100 Immediately send piece upon REQUEST 3698a0b5554fca72a59bbad6d7942387a168071b 2020-03-23T19:14:23Z 2020-03-23T19:14:23Z torrent: Print number of pieces acquired interactively Willy Goiffon dev@z3bra.org commit 3698a0b5554fca72a59bbad6d7942387a168071b parent c849aac19002f74d44d63ad8350f00601325afd3 Author: Willy Goiffon <dev@z3bra.org> Date: Mon, 23 Mar 2020 20:14:23 +0100 torrent: Print number of pieces acquired interactively c849aac19002f74d44d63ad8350f00601325afd3 2020-03-23T19:13:29Z 2020-03-23T19:13:29Z Treat HANDSHAKE as any other PWP message Willy Goiffon dev@z3bra.org commit c849aac19002f74d44d63ad8350f00601325afd3 parent e158a4f97b00d3b99b9d2d11a40af07db9883858 Author: Willy Goiffon <dev@z3bra.org> Date: Mon, 23 Mar 2020 20:13:29 +0100 Treat HANDSHAKE as any other PWP message e158a4f97b00d3b99b9d2d11a40af07db9883858 2020-03-23T12:25:24Z 2020-03-23T12:25:24Z Rename function names for readability Willy Goiffon dev@z3bra.org commit e158a4f97b00d3b99b9d2d11a40af07db9883858 parent 56d2950fcc3d48250a2eed27cbc2c551f83ee0ec Author: Willy Goiffon <dev@z3bra.org> Date: Mon, 23 Mar 2020 13:25:24 +0100 Rename function names for readability 56d2950fcc3d48250a2eed27cbc2c551f83ee0ec 2018-07-11T06:48:50Z 2018-07-11T06:48:50Z Simplify state handling for peers z3bra contactatz3bradotorg commit 56d2950fcc3d48250a2eed27cbc2c551f83ee0ec parent b5d392cf923e35b7d2dee33ca323447b4004f270 Author: z3bra <contactatz3bradotorg> Date: Wed, 11 Jul 2018 08:48:50 +0200 Simplify state handling for peers b5d392cf923e35b7d2dee33ca323447b4004f270 2018-07-11T06:09:27Z 2018-07-11T06:09:27Z Free a forgotten malloc() z3bra contactatz3bradotorg commit b5d392cf923e35b7d2dee33ca323447b4004f270 parent 51e138421357f7f58a511bb0eb9656aa9ed1674c Author: z3bra <contactatz3bradotorg> Date: Wed, 11 Jul 2018 08:09:27 +0200 Free a forgotten malloc() 51e138421357f7f58a511bb0eb9656aa9ed1674c 2018-07-09T07:04:02Z 2018-07-09T07:04:02Z Check piece only when all blocks are received z3bra contactatz3bradotorg commit 51e138421357f7f58a511bb0eb9656aa9ed1674c parent 03ccf2b025a14a05633ab312cdad29745d5071db Author: z3bra <contactatz3bradotorg> Date: Mon, 9 Jul 2018 09:04:02 +0200 Check piece only when all blocks are received 03ccf2b025a14a05633ab312cdad29745d5071db 2018-07-09T07:01:04Z 2018-07-09T07:01:04Z Request one block at a time in pwptxrq() z3bra contactatz3bradotorg commit 03ccf2b025a14a05633ab312cdad29745d5071db parent 98d359fa4fc5e1b1f9ac22e8c92fbfe04abea44b Author: z3bra <contactatz3bradotorg> Date: Mon, 9 Jul 2018 09:01:04 +0200 Request one block at a time in pwptxrq() 98d359fa4fc5e1b1f9ac22e8c92fbfe04abea44b 2018-07-09T06:34:16Z 2018-07-09T06:34:16Z Set correct size for blocks bitfields z3bra contactatz3bradotorg commit 98d359fa4fc5e1b1f9ac22e8c92fbfe04abea44b parent c10ccc735ed9378f312b3ccc5a7dd23fb0bf79e7 Author: z3bra <contactatz3bradotorg> Date: Mon, 9 Jul 2018 08:34:16 +0200 Set correct size for blocks bitfields c10ccc735ed9378f312b3ccc5a7dd23fb0bf79e7 2018-07-09T06:31:01Z 2018-07-09T06:31:01Z Remove download progress output z3bra contactatz3bradotorg commit c10ccc735ed9378f312b3ccc5a7dd23fb0bf79e7 parent 01ff08c8da3239cd769ae07f45977aa828f5cc31 Author: z3bra <contactatz3bradotorg> Date: Mon, 9 Jul 2018 08:31:01 +0200 Remove download progress output 01ff08c8da3239cd769ae07f45977aa828f5cc31 2018-07-09T06:30:42Z 2018-07-09T06:30:42Z Make default bitfield size more accurate z3bra contactatz3bradotorg commit 01ff08c8da3239cd769ae07f45977aa828f5cc31 parent 49ad884d0032f329b4d6006b1541dc3ff737148f Author: z3bra <contactatz3bradotorg> Date: Mon, 9 Jul 2018 08:30:42 +0200 Make default bitfield size more accurate 49ad884d0032f329b4d6006b1541dc3ff737148f 2018-07-09T06:30:26Z 2018-07-09T06:30:26Z Unchoke all interrested peers z3bra contactatz3bradotorg commit 49ad884d0032f329b4d6006b1541dc3ff737148f parent 34fe31c3c7b310cd8916e5f9c018293e4b0ffab9 Author: z3bra <contactatz3bradotorg> Date: Mon, 9 Jul 2018 08:30:26 +0200 Unchoke all interrested peers 34fe31c3c7b310cd8916e5f9c018293e4b0ffab9 2018-07-06T17:34:31Z 2018-07-06T17:34:31Z Only send HAVE messages when seeding z3bra contactatz3bradotorg commit 34fe31c3c7b310cd8916e5f9c018293e4b0ffab9 parent be01a156aeef06d1f908824f63aa8339dd91992b Author: z3bra <contactatz3bradotorg> Date: Fri, 6 Jul 2018 19:34:31 +0200 Only send HAVE messages when seeding By moving HAVE messages directly in the pwptx() function, they become independent from other messages, which means that we can send them anytime, and ONLY if the peer is consuming the message on the other side of the socket. One can also stop sending HAVE messages by clearing the SEEDING bit. be01a156aeef06d1f908824f63aa8339dd91992b 2018-07-06T13:29:13Z 2018-07-06T13:29:13Z Save amount of bytes downloaded z3bra contactatz3bradotorg commit be01a156aeef06d1f908824f63aa8339dd91992b parent 75028910f9e794ced6d97bb31f977a808e0b72e1 Author: z3bra <contactatz3bradotorg> Date: Fri, 6 Jul 2018 15:29:13 +0200 Save amount of bytes downloaded 75028910f9e794ced6d97bb31f977a808e0b72e1 2018-07-06T06:22:43Z 2018-07-06T06:23:30Z Add glch_piececount() to the API z3bra contactatz3bradotorg commit 75028910f9e794ced6d97bb31f977a808e0b72e1 parent ce235dc3c86e16ce041a209277ebfa9cc50848d2 Author: z3bra <contactatz3bradotorg> Date: Fri, 6 Jul 2018 08:22:43 +0200 Add glch_piececount() to the API ce235dc3c86e16ce041a209277ebfa9cc50848d2 2018-07-05T11:56:30Z 2018-07-05T11:56:30Z Do not create peer in addpeer() z3bra contactatz3bradotorg commit ce235dc3c86e16ce041a209277ebfa9cc50848d2 parent fad1cd5caca4176138b2378e02f18c782ecd886f Author: z3bra <contactatz3bradotorg> Date: Thu, 5 Jul 2018 13:56:30 +0200 Do not create peer in addpeer() fad1cd5caca4176138b2378e02f18c782ecd886f 2018-07-05T07:02:35Z 2018-07-05T08:22:33Z Describe all functions z3bra contactatz3bradotorg commit fad1cd5caca4176138b2378e02f18c782ecd886f parent e308b69b6b819eed9e2e29cab389ce4879c61d8b Author: z3bra <contactatz3bradotorg> Date: Thu, 5 Jul 2018 09:02:35 +0200 Describe all functions e308b69b6b819eed9e2e29cab389ce4879c61d8b 2018-07-05T06:15:00Z 2018-07-05T08:22:33Z Permit requesting multiple pieces z3bra contactatz3bradotorg commit e308b69b6b819eed9e2e29cab389ce4879c61d8b parent 115117034d00618ff235ffc27b60277035a0e759 Author: z3bra <contactatz3bradotorg> Date: Thu, 5 Jul 2018 08:15:00 +0200 Permit requesting multiple pieces 115117034d00618ff235ffc27b60277035a0e759 2018-07-05T06:14:42Z 2018-07-05T08:22:33Z Group leeching-related actions together z3bra contactatz3bradotorg commit 115117034d00618ff235ffc27b60277035a0e759 parent 774c0676d1298d2731342468f3f53c0f4e5a9630 Author: z3bra <contactatz3bradotorg> Date: Thu, 5 Jul 2018 08:14:42 +0200 Group leeching-related actions together 774c0676d1298d2731342468f3f53c0f4e5a9630 2018-07-05T06:14:06Z 2018-07-05T08:22:33Z Fix off-by-one error with when passing payload to pwprxcb() z3bra contactatz3bradotorg commit 774c0676d1298d2731342468f3f53c0f4e5a9630 parent f7370a56387cdf870b62b309db021c9c4f2ae9bd Author: z3bra <contactatz3bradotorg> Date: Thu, 5 Jul 2018 08:14:06 +0200 Fix off-by-one error with when passing payload to pwprxcb() f7370a56387cdf870b62b309db021c9c4f2ae9bd 2018-07-04T17:36:01Z 2018-07-05T08:22:33Z Fix HAVE message format z3bra contactatz3bradotorg commit f7370a56387cdf870b62b309db021c9c4f2ae9bd parent 207bde90ffe79608f7ac5c69117bb379a9648903 Author: z3bra <contactatz3bradotorg> Date: Wed, 4 Jul 2018 19:36:01 +0200 Fix HAVE message format 207bde90ffe79608f7ac5c69117bb379a9648903 2018-07-04T06:56:49Z 2018-07-05T08:22:33Z Broadcast HAVE messages when receiving a piece z3bra contactatz3bradotorg commit 207bde90ffe79608f7ac5c69117bb379a9648903 parent e4776677ff079bc800b63a77587528bae051067b Author: z3bra <contactatz3bradotorg> Date: Wed, 4 Jul 2018 08:56:49 +0200 Broadcast HAVE messages when receiving a piece e4776677ff079bc800b63a77587528bae051067b 2018-07-04T06:53:34Z 2018-07-05T08:22:33Z Correctly set bitfield, and actually send it z3bra contactatz3bradotorg commit e4776677ff079bc800b63a77587528bae051067b parent ac6b3082a4dcd6694b7171658356d7bb917f1097 Author: z3bra <contactatz3bradotorg> Date: Wed, 4 Jul 2018 08:53:34 +0200 Correctly set bitfield, and actually send it ac6b3082a4dcd6694b7171658356d7bb917f1097 2018-07-04T06:52:38Z 2018-07-05T08:22:33Z Improve pwpsend() to send all data z3bra contactatz3bradotorg commit ac6b3082a4dcd6694b7171658356d7bb917f1097 parent 4d2331780189dff51f9159dbaab0b972efd9b237 Author: z3bra <contactatz3bradotorg> Date: Wed, 4 Jul 2018 08:52:38 +0200 Improve pwpsend() to send all data 4d2331780189dff51f9159dbaab0b972efd9b237 2018-07-04T06:52:10Z 2018-07-05T08:22:33Z Read piece from metafile (./<HASH>) instead of files z3bra contactatz3bradotorg commit 4d2331780189dff51f9159dbaab0b972efd9b237 parent a9cf1902aadd303a909d2f09d434b4d936b8cc90 Author: z3bra <contactatz3bradotorg> Date: Wed, 4 Jul 2018 08:52:10 +0200 Read piece from metafile (./<HASH>) instead of files a9cf1902aadd303a909d2f09d434b4d936b8cc90 2018-07-03T22:37:25Z 2018-07-05T08:22:33Z pwptxhv(): pass piece number as long z3bra contactatz3bradotorg commit a9cf1902aadd303a909d2f09d434b4d936b8cc90 parent 586e58d4469b1212bcd72ca83d546f3b3437380f Author: z3bra <contactatz3bradotorg> Date: Wed, 4 Jul 2018 00:37:25 +0200 pwptxhv(): pass piece number as long 586e58d4469b1212bcd72ca83d546f3b3437380f 2018-07-03T21:39:07Z 2018-07-05T08:22:33Z Remove ugly off++ trick for 4 bytes big endian integers z3bra contactatz3bradotorg commit 586e58d4469b1212bcd72ca83d546f3b3437380f parent 1871407a84e54060480834c2b7577b62dfd12198 Author: z3bra <contactatz3bradotorg> Date: Tue, 3 Jul 2018 23:39:07 +0200 Remove ugly off++ trick for 4 bytes big endian integers 1871407a84e54060480834c2b7577b62dfd12198 2018-07-03T21:28:11Z 2018-07-05T08:22:33Z Correctly define TCP functions pwprecv/pwpsend z3bra contactatz3bradotorg commit 1871407a84e54060480834c2b7577b62dfd12198 parent 43f71d66c05978eb4778835f80b83ac57dec3504 Author: z3bra <contactatz3bradotorg> Date: Tue, 3 Jul 2018 23:28:11 +0200 Correctly define TCP functions pwprecv/pwpsend 43f71d66c05978eb4778835f80b83ac57dec3504 2018-07-03T13:37:52Z 2018-07-05T08:22:32Z Print hexadecimal hash in torrent output z3bra willy at mailoo dot org commit 43f71d66c05978eb4778835f80b83ac57dec3504 parent 00a21c7271abed9eb6faa3d028e706f04c5f5128 Author: z3bra <willy at mailoo dot org> Date: Tue, 3 Jul 2018 15:37:52 +0200 Print hexadecimal hash in torrent output 00a21c7271abed9eb6faa3d028e706f04c5f5128 2018-07-03T13:37:20Z 2018-07-05T08:22:27Z Write pieces received to a metafile z3bra willy at mailoo dot org commit 00a21c7271abed9eb6faa3d028e706f04c5f5128 parent 7534ab0fb8db1833a70ac699db471235974a5e23 Author: z3bra <willy at mailoo dot org> Date: Tue, 3 Jul 2018 15:37:20 +0200 Write pieces received to a metafile 7534ab0fb8db1833a70ac699db471235974a5e23 2018-07-02T16:18:17Z 2018-07-05T08:22:17Z Fix typos and missing macros here and there z3bra willy at mailoo dot org commit 7534ab0fb8db1833a70ac699db471235974a5e23 parent acf33003428d73d519a5eacafcbb855c2eb6e3c2 Author: z3bra <willy at mailoo dot org> Date: Mon, 2 Jul 2018 18:18:17 +0200 Fix typos and missing macros here and there acf33003428d73d519a5eacafcbb855c2eb6e3c2 2018-07-02T16:17:00Z 2018-07-05T08:21:56Z Fix initial offset when reading data z3bra willy at mailoo dot org commit acf33003428d73d519a5eacafcbb855c2eb6e3c2 parent af81ef0e03792a5408783394c1d9bc29dcc0ff0b Author: z3bra <willy at mailoo dot org> Date: Mon, 2 Jul 2018 18:17:00 +0200 Fix initial offset when reading data af81ef0e03792a5408783394c1d9bc29dcc0ff0b 2018-07-02T06:53:06Z 2018-07-02T06:53:06Z Fix issues with U32() macro z3bra contactatz3bradotorg commit af81ef0e03792a5408783394c1d9bc29dcc0ff0b parent d1b10606edf81df3f81e863bca63384d9bc44ae3 Author: z3bra <contactatz3bradotorg> Date: Mon, 2 Jul 2018 08:53:06 +0200 Fix issues with U32() macro The macro was OR'ing values that were not zeroed, thus resulting in bad values if integers were included crap random bits. d1b10606edf81df3f81e863bca63384d9bc44ae3 2018-07-01T11:23:15Z 2018-07-01T11:23:15Z Start implementing pwprxpc() z3bra contactatz3bradotorg commit d1b10606edf81df3f81e863bca63384d9bc44ae3 parent f95c99456e8f5cfa576199c8006fd8898ca1e182 Author: z3bra <contactatz3bradotorg> Date: Sun, 1 Jul 2018 13:23:15 +0200 Start implementing pwprxpc() f95c99456e8f5cfa576199c8006fd8898ca1e182 2018-07-01T11:12:53Z 2018-07-01T11:12:53Z torrent: Mark host/port arguments as optionals z3bra contactatz3bradotorg commit f95c99456e8f5cfa576199c8006fd8898ca1e182 parent d6e214df9c132f3fc29a82d30ff5b39ba3ef860d Author: z3bra <contactatz3bradotorg> Date: Sun, 1 Jul 2018 13:12:53 +0200 torrent: Mark host/port arguments as optionals d6e214df9c132f3fc29a82d30ff5b39ba3ef860d 2018-07-01T11:09:13Z 2018-07-01T11:09:50Z Rename sending function with 'tx' for clarity z3bra contactatz3bradotorg commit d6e214df9c132f3fc29a82d30ff5b39ba3ef860d parent 6b4860db6568bda6501332cb6134d1aeb0d9289c Author: z3bra <contactatz3bradotorg> Date: Sun, 1 Jul 2018 13:09:13 +0200 Rename sending function with 'tx' for clarity 6b4860db6568bda6501332cb6134d1aeb0d9289c 2018-07-01T11:02:26Z 2018-07-01T11:02:26Z Implement function pwphv() to send HAVE messages z3bra contactatz3bradotorg commit 6b4860db6568bda6501332cb6134d1aeb0d9289c parent 8bd983aaaf8eba4628785591c859d718300103a1 Author: z3bra <contactatz3bradotorg> Date: Sun, 1 Jul 2018 13:02:26 +0200 Implement function pwphv() to send HAVE messages 8bd983aaaf8eba4628785591c859d718300103a1 2018-07-01T10:56:19Z 2018-07-01T10:56:19Z Remove printf() debuging statements z3bra contactatz3bradotorg commit 8bd983aaaf8eba4628785591c859d718300103a1 parent 009a0a8e71b2c329bd722650daf254bf81d82e19 Author: z3bra <contactatz3bradotorg> Date: Sun, 1 Jul 2018 12:56:19 +0200 Remove printf() debuging statements 009a0a8e71b2c329bd722650daf254bf81d82e19 2018-07-01T10:55:16Z 2018-07-01T10:55:16Z Implement pwprxst, pwprxhv and pwprxbf z3bra contactatz3bradotorg commit 009a0a8e71b2c329bd722650daf254bf81d82e19 parent cdd7c5d525296210093f84fc0407f6bb0012a7c3 Author: z3bra <contactatz3bradotorg> Date: Sun, 1 Jul 2018 12:55:16 +0200 Implement pwprxst, pwprxhv and pwprxbf cdd7c5d525296210093f84fc0407f6bb0012a7c3 2018-07-01T10:54:45Z 2018-07-01T10:54:45Z Setup callback functions for received messages z3bra contactatz3bradotorg commit cdd7c5d525296210093f84fc0407f6bb0012a7c3 parent 4d12ab42b1daabd2261e55ef66ca8d6f42d206a1 Author: z3bra <contactatz3bradotorg> Date: Sun, 1 Jul 2018 12:54:45 +0200 Setup callback functions for received messages 4d12ab42b1daabd2261e55ef66ca8d6f42d206a1 2018-07-01T10:53:49Z 2018-07-01T10:53:49Z Rearrange pwp function in message type order z3bra contactatz3bradotorg commit 4d12ab42b1daabd2261e55ef66ca8d6f42d206a1 parent e225e5d0cb91814ee69fa1ca0ed2d912791719fd Author: z3bra <contactatz3bradotorg> Date: Sun, 1 Jul 2018 12:53:49 +0200 Rearrange pwp function in message type order e225e5d0cb91814ee69fa1ca0ed2d912791719fd 2018-06-29T23:28:22Z 2018-06-29T23:28:22Z Add pwprq() for requesting pieces z3bra contactatz3bradotorg commit e225e5d0cb91814ee69fa1ca0ed2d912791719fd parent 92e07b92638cf8d3884da8aa60724057e2a6545f Author: z3bra <contactatz3bradotorg> Date: Sat, 30 Jun 2018 01:28:22 +0200 Add pwprq() for requesting pieces 92e07b92638cf8d3884da8aa60724057e2a6545f 2018-06-29T23:27:13Z 2018-06-29T23:27:50Z Add handlers for simple messages z3bra contactatz3bradotorg commit 92e07b92638cf8d3884da8aa60724057e2a6545f parent 15d5a438034b9722da96ae6264b34dbb9641f1ba Author: z3bra <contactatz3bradotorg> Date: Sat, 30 Jun 2018 01:27:13 +0200 Add handlers for simple messages 15d5a438034b9722da96ae6264b34dbb9641f1ba 2018-06-29T23:26:03Z 2018-06-29T23:26:03Z Fix bugs due to binary operator precedence z3bra contactatz3bradotorg commit 15d5a438034b9722da96ae6264b34dbb9641f1ba parent fe9bdcbb5f33ca30a4e78fd4bbd4942f846049b9 Author: z3bra <contactatz3bradotorg> Date: Sat, 30 Jun 2018 01:26:03 +0200 Fix bugs due to binary operator precedence fe9bdcbb5f33ca30a4e78fd4bbd4942f846049b9 2018-06-29T21:06:12Z 2018-06-29T23:24:13Z Remove some more malloc() z3bra contactatz3bradotorg commit fe9bdcbb5f33ca30a4e78fd4bbd4942f846049b9 parent e399823985f0dc7169562860c68296139e259d87 Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 23:06:12 +0200 Remove some more malloc() e399823985f0dc7169562860c68296139e259d87 2018-06-29T20:59:57Z 2018-06-29T20:59:57Z Remove struct data for struct piece z3bra contactatz3bradotorg commit e399823985f0dc7169562860c68296139e259d87 parent 87b942d302df90a66247babfad7dbaf08602d9ac Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 22:59:57 +0200 Remove struct data for struct piece `struct data` was meant to hold any kind of data, while holding its size. It was used in the torrent struct, to hold and keep in memory all the pieces. On startup, the pieces are all read and checked in the same struct, to avoid keeping the whole torrent in memory. This also removes the need for malloc() calls, which is always a plus! 87b942d302df90a66247babfad7dbaf08602d9ac 2018-06-29T20:28:56Z 2018-06-29T20:28:56Z Use enums for message types z3bra contactatz3bradotorg commit 87b942d302df90a66247babfad7dbaf08602d9ac parent 0fe563fb8981489d3dec676c091bd1628dffb252 Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 22:28:56 +0200 Use enums for message types 0fe563fb8981489d3dec676c091bd1628dffb252 2018-06-29T20:19:31Z 2018-06-29T20:19:31Z Add pwpinterest() prototype z3bra contactatz3bradotorg commit 0fe563fb8981489d3dec676c091bd1628dffb252 parent c9bfa5e7c88fa7ab0ed18797fa432164bc89e67f Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 22:19:31 +0200 Add pwpinterest() prototype c9bfa5e7c88fa7ab0ed18797fa432164bc89e67f 2018-06-29T19:24:59Z 2018-06-29T19:24:59Z Add bitfield for peers z3bra contactatz3bradotorg commit c9bfa5e7c88fa7ab0ed18797fa432164bc89e67f parent a4a521c672ec7664c591e2fc30fde889300e9496 Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 21:24:59 +0200 Add bitfield for peers a4a521c672ec7664c591e2fc30fde889300e9496 2018-06-29T19:03:32Z 2018-06-29T19:03:32Z Send INTERESTED message when leeching z3bra contactatz3bradotorg commit a4a521c672ec7664c591e2fc30fde889300e9496 parent 4616e4a455bc12ababe1bf987375cdfb89327654 Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 21:03:32 +0200 Send INTERESTED message when leeching 4616e4a455bc12ababe1bf987375cdfb89327654 2018-06-29T19:02:34Z 2018-06-29T19:02:34Z Remove unsused variable from pwprecv() z3bra contactatz3bradotorg commit 4616e4a455bc12ababe1bf987375cdfb89327654 parent e7efd126cddc29317299860c1fbd2c8c783c6eda Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 21:02:34 +0200 Remove unsused variable from pwprecv() e7efd126cddc29317299860c1fbd2c8c783c6eda 2018-06-29T16:20:51Z 2018-06-29T16:21:12Z Improve torrent example code to use dynamic host:port z3bra contactatz3bradotorg commit e7efd126cddc29317299860c1fbd2c8c783c6eda parent 5d82b5c139f3e89344a9b34ee04dcc7f666ebc40 Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 18:20:51 +0200 Improve torrent example code to use dynamic host:port 5d82b5c139f3e89344a9b34ee04dcc7f666ebc40 2018-06-29T15:58:09Z 2018-06-29T15:58:09Z Rename buffer variables z3bra contactatz3bradotorg commit 5d82b5c139f3e89344a9b34ee04dcc7f666ebc40 parent 59aab58e207a45ed4a4f9a32999c4decb2bf821d Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 17:58:09 +0200 Rename buffer variables 59aab58e207a45ed4a4f9a32999c4decb2bf821d 2018-06-29T05:58:29Z 2018-06-29T05:58:29Z Only check pieces that can be read z3bra contactatz3bradotorg commit 59aab58e207a45ed4a4f9a32999c4decb2bf821d parent 6d93917b1646e7777780e7891ab8dc41e36e076d Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 07:58:29 +0200 Only check pieces that can be read 6d93917b1646e7777780e7891ab8dc41e36e076d 2018-06-29T05:58:10Z 2018-06-29T05:58:10Z Print message ID only when we receive a message z3bra contactatz3bradotorg commit 6d93917b1646e7777780e7891ab8dc41e36e076d parent c1adc61b9c6af64d09843c2f53e7222683ed04aa Author: z3bra <contactatz3bradotorg> Date: Fri, 29 Jun 2018 07:58:10 +0200 Print message ID only when we receive a message c1adc61b9c6af64d09843c2f53e7222683ed04aa 2018-02-25T13:14:52Z 2018-02-25T13:14:52Z Add function to receive messages z3bra contactatz3bradotorg commit c1adc61b9c6af64d09843c2f53e7222683ed04aa parent 4129efb6930f09c75b9c9037579149f538a038d6 Author: z3bra <contactatz3bradotorg> Date: Sun, 25 Feb 2018 08:14:52 -0500 Add function to receive messages 4129efb6930f09c75b9c9037579149f538a038d6 2018-02-25T12:30:44Z 2018-02-25T12:30:44Z Send bitfield right after handshake z3bra contactatz3bradotorg commit 4129efb6930f09c75b9c9037579149f538a038d6 parent 80845b4a09b0032d352fb34678e09d03e6f2400c Author: z3bra <contactatz3bradotorg> Date: Sun, 25 Feb 2018 07:30:44 -0500 Send bitfield right after handshake 80845b4a09b0032d352fb34678e09d03e6f2400c 2018-02-25T11:28:18Z 2018-02-25T11:28:34Z Set bitfield on startup z3bra contactatz3bradotorg commit 80845b4a09b0032d352fb34678e09d03e6f2400c parent a3feb8c50165995ebc29431f7ec15ada67ddb92f Author: z3bra <contactatz3bradotorg> Date: Sun, 25 Feb 2018 06:28:18 -0500 Set bitfield on startup a3feb8c50165995ebc29431f7ec15ada67ddb92f 2018-02-25T11:26:45Z 2018-02-25T11:26:45Z Add functions to alterate/query bits z3bra contactatz3bradotorg commit a3feb8c50165995ebc29431f7ec15ada67ddb92f parent 7f5175a8d8f118bbc9f5b0f8d68c240020495d28 Author: z3bra <contactatz3bradotorg> Date: Sun, 25 Feb 2018 06:26:45 -0500 Add functions to alterate/query bits 7f5175a8d8f118bbc9f5b0f8d68c240020495d28 2018-02-14T04:25:31Z 2018-02-14T04:25:31Z Return immediately upon deleting a peer z3bra contactatz3bradotorg commit 7f5175a8d8f118bbc9f5b0f8d68c240020495d28 parent 84c079251a69ad84d676a2b0db32a8b3f8ca96c7 Author: z3bra <contactatz3bradotorg> Date: Tue, 13 Feb 2018 23:25:31 -0500 Return immediately upon deleting a peer 84c079251a69ad84d676a2b0db32a8b3f8ca96c7 2018-02-14T04:21:28Z 2018-02-14T04:21:28Z Factorize transmitting/receiving messages z3bra contactatz3bradotorg commit 84c079251a69ad84d676a2b0db32a8b3f8ca96c7 parent ddf51c1ca8e2c0f84e146cf52d019a599b5c45c2 Author: z3bra <contactatz3bradotorg> Date: Tue, 13 Feb 2018 23:21:28 -0500 Factorize transmitting/receiving messages ddf51c1ca8e2c0f84e146cf52d019a599b5c45c2 2018-02-14T03:40:45Z 2018-02-14T03:40:45Z Initialize peer numbers in netloop z3bra contactatz3bradotorg commit ddf51c1ca8e2c0f84e146cf52d019a599b5c45c2 parent 2eea005257be3fa89a34c62e77a51956e2605867 Author: z3bra <contactatz3bradotorg> Date: Tue, 13 Feb 2018 22:40:45 -0500 Initialize peer numbers in netloop 2eea005257be3fa89a34c62e77a51956e2605867 2018-02-11T02:28:09Z 2018-02-11T02:28:09Z Read pieces from file and verify their checksum z3bra contactatz3bradotorg commit 2eea005257be3fa89a34c62e77a51956e2605867 parent 97095244b34d1cc1b0678b9dcd84908ae9388cb6 Author: z3bra <contactatz3bradotorg> Date: Sun, 11 Feb 2018 03:28:09 +0100 Read pieces from file and verify their checksum 97095244b34d1cc1b0678b9dcd84908ae9388cb6 2018-02-10T12:54:56Z 2018-02-10T12:54:56Z Retrieve piece len, number and sha1 from torrent file z3bra contactatz3bradotorg commit 97095244b34d1cc1b0678b9dcd84908ae9388cb6 parent 802b7ec302e36a3e2bc57cae0d09114093181ecc Author: z3bra <contactatz3bradotorg> Date: Sat, 10 Feb 2018 13:54:56 +0100 Retrieve piece len, number and sha1 from torrent file 802b7ec302e36a3e2bc57cae0d09114093181ecc 2018-02-10T12:51:55Z 2018-02-10T12:51:55Z Add two more states z3bra contactatz3bradotorg commit 802b7ec302e36a3e2bc57cae0d09114093181ecc parent 84e77364f46895cec2614f767a013028611f9962 Author: z3bra <contactatz3bradotorg> Date: Sat, 10 Feb 2018 13:51:55 +0100 Add two more states 84e77364f46895cec2614f767a013028611f9962 2018-02-10T12:51:30Z 2018-02-10T12:51:30Z Factorize handshake checks functions z3bra contactatz3bradotorg commit 84e77364f46895cec2614f767a013028611f9962 parent e93c18236b4d74ace9d237ffaf1ec75b7c17ea72 Author: z3bra <contactatz3bradotorg> Date: Sat, 10 Feb 2018 13:51:30 +0100 Factorize handshake checks functions e93c18236b4d74ace9d237ffaf1ec75b7c17ea72 2018-02-10T11:35:25Z 2018-02-10T11:35:25Z Use a structure to handle peer's socket polling z3bra contactatz3bradotorg commit e93c18236b4d74ace9d237ffaf1ec75b7c17ea72 parent 0d1a23c249eff31fecba9735ac0a4d537e3144e6 Author: z3bra <contactatz3bradotorg> Date: Sat, 10 Feb 2018 12:35:25 +0100 Use a structure to handle peer's socket polling 0d1a23c249eff31fecba9735ac0a4d537e3144e6 2017-11-06T11:47:03Z 2018-02-09T21:46:31Z Rename tcpconnect() to netconn() z3bra contactatz3bradotorg commit 0d1a23c249eff31fecba9735ac0a4d537e3144e6 parent 7e9e6a0571c4e55eaa9668eda0da0595ebce8931 Author: z3bra <contactatz3bradotorg> Date: Mon, 6 Nov 2017 12:47:03 +0100 Rename tcpconnect() to netconn() 7e9e6a0571c4e55eaa9668eda0da0595ebce8931 2018-02-09T21:44:37Z 2018-02-09T21:44:37Z Finer state change z3bra contactatz3bradotorg commit 7e9e6a0571c4e55eaa9668eda0da0595ebce8931 parent dfdb0fe7098b4c2789baac70e528ec734cfe82b5 Author: z3bra <contactatz3bradotorg> Date: Fri, 9 Feb 2018 22:44:37 +0100 Finer state change dfdb0fe7098b4c2789baac70e528ec734cfe82b5 2017-11-04T20:11:08Z 2017-11-04T20:11:08Z netloop() to handle peer connections z3bra contactatz3bradotorg commit dfdb0fe7098b4c2789baac70e528ec734cfe82b5 parent 4677f08d67ca79c4bd76bd9dfa1ac161b30869f4 Author: z3bra <contactatz3bradotorg> Date: Sat, 4 Nov 2017 21:11:08 +0100 netloop() to handle peer connections 4677f08d67ca79c4bd76bd9dfa1ac161b30869f4 2017-11-04T19:22:52Z 2017-11-04T19:22:52Z Establish connection to peer immediately z3bra contactatz3bradotorg commit 4677f08d67ca79c4bd76bd9dfa1ac161b30869f4 parent f5efe190eced0897d976e704782ea3db3a4096a0 Author: z3bra <contactatz3bradotorg> Date: Sat, 4 Nov 2017 20:22:52 +0100 Establish connection to peer immediately f5efe190eced0897d976e704782ea3db3a4096a0 2017-11-03T16:48:50Z 2017-11-03T16:48:50Z Make pwphs* functions static z3bra contactatz3bradotorg commit f5efe190eced0897d976e704782ea3db3a4096a0 parent 8da0e6a47d6a1ef74286752a48fa0d67c33cfe34 Author: z3bra <contactatz3bradotorg> Date: Fri, 3 Nov 2017 17:48:50 +0100 Make pwphs* functions static 8da0e6a47d6a1ef74286752a48fa0d67c33cfe34 2017-11-03T16:48:07Z 2017-11-03T16:48:07Z pwphsck() verify handshake z3bra contactatz3bradotorg commit 8da0e6a47d6a1ef74286752a48fa0d67c33cfe34 parent d8cb67c19cd23514c75e2697b7da2389d03d5c10 Author: z3bra <contactatz3bradotorg> Date: Fri, 3 Nov 2017 17:48:07 +0100 pwphsck() verify handshake d8cb67c19cd23514c75e2697b7da2389d03d5c10 2017-11-03T16:28:18Z 2017-11-03T16:28:18Z pwphsrecv(): receive handshake from peer z3bra contactatz3bradotorg commit d8cb67c19cd23514c75e2697b7da2389d03d5c10 parent 5a9abb4e87943ab271a1ac7b4531665a13fd3ef0 Author: z3bra <contactatz3bradotorg> Date: Fri, 3 Nov 2017 17:28:18 +0100 pwphsrecv(): receive handshake from peer 5a9abb4e87943ab271a1ac7b4531665a13fd3ef0 2017-11-03T15:33:17Z 2017-11-03T15:33:17Z pwphs(): send handshake to peer z3bra contactatz3bradotorg commit 5a9abb4e87943ab271a1ac7b4531665a13fd3ef0 parent 733ceaa38e147aec1a34dcb7fb3d4135a3b452a8 Author: z3bra <contactatz3bradotorg> Date: Fri, 3 Nov 2017 16:33:17 +0100 pwphs(): send handshake to peer 733ceaa38e147aec1a34dcb7fb3d4135a3b452a8 2017-11-03T14:59:45Z 2017-11-03T14:59:45Z Add functions to manage peers z3bra contactatz3bradotorg commit 733ceaa38e147aec1a34dcb7fb3d4135a3b452a8 parent ebf503552dc21e5192be8f126dc9f65ae8f2529c Author: z3bra <contactatz3bradotorg> Date: Fri, 3 Nov 2017 15:59:45 +0100 Add functions to manage peers ebf503552dc21e5192be8f126dc9f65ae8f2529c 2017-10-23T12:10:41Z 2017-10-23T12:10:41Z Add function to save file list z3bra contactatz3bradotorg commit ebf503552dc21e5192be8f126dc9f65ae8f2529c parent af359fd15ba51750850011b0fd8525d0fe08f45c Author: z3bra <contactatz3bradotorg> Date: Mon, 23 Oct 2017 14:10:41 +0200 Add function to save file list af359fd15ba51750850011b0fd8525d0fe08f45c 2017-10-23T12:10:05Z 2017-10-23T12:10:05Z Use torrent.info in torrentsize() z3bra contactatz3bradotorg commit af359fd15ba51750850011b0fd8525d0fe08f45c parent 073f62ba589de7076916bc88119e6bc64ff0990b Author: z3bra <contactatz3bradotorg> Date: Mon, 23 Oct 2017 14:10:05 +0200 Use torrent.info in torrentsize() 073f62ba589de7076916bc88119e6bc64ff0990b 2017-10-22T08:40:29Z 2017-10-22T08:40:29Z Add comments z3bra contactatz3bradotorg commit 073f62ba589de7076916bc88119e6bc64ff0990b parent 1dbca24f67c51c35b0ea0c3b7e2d98b85eec5005 Author: z3bra <contactatz3bradotorg> Date: Sun, 22 Oct 2017 10:40:29 +0200 Add comments 1dbca24f67c51c35b0ea0c3b7e2d98b85eec5005 2017-10-22T08:40:18Z 2017-10-22T08:40:18Z Save torrent size z3bra contactatz3bradotorg commit 1dbca24f67c51c35b0ea0c3b7e2d98b85eec5005 parent 565c2cd5e1797bdab81b3f82bcc5af1033330aaf Author: z3bra <contactatz3bradotorg> Date: Sun, 22 Oct 2017 10:40:18 +0200 Save torrent size 565c2cd5e1797bdab81b3f82bcc5af1033330aaf 2017-10-22T08:28:45Z 2017-10-22T08:28:45Z Remove useless factorization from glch_loadtorrent() z3bra contactatz3bradotorg commit 565c2cd5e1797bdab81b3f82bcc5af1033330aaf parent 5868460df17098197b391fac804998f67ef696cf Author: z3bra <contactatz3bradotorg> Date: Sun, 22 Oct 2017 10:28:45 +0200 Remove useless factorization from glch_loadtorrent() 5868460df17098197b391fac804998f67ef696cf 2017-10-22T08:21:00Z 2017-10-22T08:21:00Z New function to check torrent entegrity z3bra contactatz3bradotorg commit 5868460df17098197b391fac804998f67ef696cf parent 30c885bf1a9870d5d0d983ad719511eaccd052d4 Author: z3bra <contactatz3bradotorg> Date: Sun, 22 Oct 2017 10:21:00 +0200 New function to check torrent entegrity 30c885bf1a9870d5d0d983ad719511eaccd052d4 2017-10-22T06:56:34Z 2017-10-22T06:56:41Z Have bekstr() return a bencoding structure z3bra contactatz3bradotorg commit 30c885bf1a9870d5d0d983ad719511eaccd052d4 parent a9b0348be67fa7baacce53c098b659e7e24b0268 Author: z3bra <contactatz3bradotorg> Date: Sun, 22 Oct 2017 08:56:34 +0200 Have bekstr() return a bencoding structure a9b0348be67fa7baacce53c098b659e7e24b0268 2017-10-20T06:49:11Z 2017-10-20T06:49:11Z Get rid of loadinfohash by saving the 'info' key data z3bra contactatz3bradotorg commit a9b0348be67fa7baacce53c098b659e7e24b0268 parent b16c6fa5a688b03a0488129f4351475b9751d5bc Author: z3bra <contactatz3bradotorg> Date: Fri, 20 Oct 2017 08:49:11 +0200 Get rid of loadinfohash by saving the 'info' key data b16c6fa5a688b03a0488129f4351475b9751d5bc 2017-10-19T15:05:41Z 2017-10-19T15:05:41Z Load infohash in torrent structure z3bra contactatz3bradotorg commit b16c6fa5a688b03a0488129f4351475b9751d5bc parent f63985b044c1830c68418b81dfd33bb0d81fb08d Author: z3bra <contactatz3bradotorg> Date: Thu, 19 Oct 2017 17:05:41 +0200 Load infohash in torrent structure f63985b044c1830c68418b81dfd33bb0d81fb08d 2017-10-19T14:33:50Z 2017-10-19T14:33:50Z Simplify interger search for bencoded data z3bra contactatz3bradotorg commit f63985b044c1830c68418b81dfd33bb0d81fb08d parent 286c8e057c6773a0179200a7d964e4fcb4133010 Author: z3bra <contactatz3bradotorg> Date: Thu, 19 Oct 2017 16:33:50 +0200 Simplify interger search for bencoded data 286c8e057c6773a0179200a7d964e4fcb4133010 2017-10-19T14:24:36Z 2017-10-19T14:24:36Z Simplify infohash() checksum calculus z3bra contactatz3bradotorg commit 286c8e057c6773a0179200a7d964e4fcb4133010 parent b033a8902e08c34d57038b8358ea736e77138582 Author: z3bra <contactatz3bradotorg> Date: Thu, 19 Oct 2017 16:24:36 +0200 Simplify infohash() checksum calculus b033a8902e08c34d57038b8358ea736e77138582 2017-10-19T12:44:17Z 2017-10-19T12:44:17Z tohex(): use unsigned values z3bra contactatz3bradotorg commit b033a8902e08c34d57038b8358ea736e77138582 parent b30bde52988a54111ddb043a062bf5332d44e9b0 Author: z3bra <contactatz3bradotorg> Date: Thu, 19 Oct 2017 14:44:17 +0200 tohex(): use unsigned values b30bde52988a54111ddb043a062bf5332d44e9b0 2017-10-19T12:29:23Z 2017-10-19T12:29:25Z Remove ability to read files z3bra contactatz3bradotorg commit b30bde52988a54111ddb043a062bf5332d44e9b0 parent a191041cb05e1a0da2f597436fd393d355c4f9c9 Author: z3bra <contactatz3bradotorg> Date: Thu, 19 Oct 2017 14:29:23 +0200 Remove ability to read files This should be implemented by the client a191041cb05e1a0da2f597436fd393d355c4f9c9 2017-10-19T06:25:24Z 2017-10-19T10:22:03Z Get rid of unsigned char type z3bra contactatz3bradotorg commit a191041cb05e1a0da2f597436fd393d355c4f9c9 parent ba84409915193ec48b1becfaf434e3a1ba780628 Author: z3bra <contactatz3bradotorg> Date: Thu, 19 Oct 2017 08:25:24 +0200 Get rid of unsigned char type ba84409915193ec48b1becfaf434e3a1ba780628 2017-10-18T22:13:33Z 2017-10-18T22:13:33Z Function to retrieve torrent size z3bra contactatz3bradotorg commit ba84409915193ec48b1becfaf434e3a1ba780628 parent 1f684681b6e996a18378c7567a1fa0b1fe903a45 Author: z3bra <contactatz3bradotorg> Date: Thu, 19 Oct 2017 00:13:33 +0200 Function to retrieve torrent size 1f684681b6e996a18378c7567a1fa0b1fe903a45 2017-10-18T21:56:38Z 2017-10-18T21:56:38Z Helper to retrieve infohash from metadata z3bra contactatz3bradotorg commit 1f684681b6e996a18378c7567a1fa0b1fe903a45 parent 06340e51868101e64aa9275708e54b89b3c498f5 Author: z3bra <contactatz3bradotorg> Date: Wed, 18 Oct 2017 23:56:38 +0200 Helper to retrieve infohash from metadata 06340e51868101e64aa9275708e54b89b3c498f5 2017-10-18T10:32:06Z 2017-10-18T10:32:06Z Add possibility to load info dictionary from memory z3bra contactatz3bradotorg commit 06340e51868101e64aa9275708e54b89b3c498f5 parent 27f38a6292d4d6c6de8ea1712dc5060024b44189 Author: z3bra <contactatz3bradotorg> Date: Wed, 18 Oct 2017 12:32:06 +0200 Add possibility to load info dictionary from memory 27f38a6292d4d6c6de8ea1712dc5060024b44189 2017-10-18T06:47:49Z 2017-10-18T06:47:49Z Factorize glch_loadtorrent() into smaller functions z3bra contactatz3bradotorg commit 27f38a6292d4d6c6de8ea1712dc5060024b44189 parent 34cb6c512c6609748925c64f4b8058ef3dc30e5d Author: z3bra <contactatz3bradotorg> Date: Wed, 18 Oct 2017 08:47:49 +0200 Factorize glch_loadtorrent() into smaller functions 34cb6c512c6609748925c64f4b8058ef3dc30e5d 2017-10-18T06:31:26Z 2017-10-18T06:31:26Z Store infohash and fix up some bencoding functions z3bra contactatz3bradotorg commit 34cb6c512c6609748925c64f4b8058ef3dc30e5d parent f06d22e78655ee04d1f813f2edbaf5f365a07cc0 Author: z3bra <contactatz3bradotorg> Date: Wed, 18 Oct 2017 08:31:26 +0200 Store infohash and fix up some bencoding functions