Commit Graph
199 Commits
Author SHA1 Message Date
Darren Horrocks cfaa040fd0 release pipeline version/3.0.0 2026-06-29 09:46:38 +01:00
Darren Horrocks 50082a6607 crash fix on download complete 2026-06-29 09:36:46 +01:00
Darren Horrocks e402476122 updated readme 2026-06-28 23:32:59 +01:00
Darren Horrocks 800f207bc0 multiple fixes, added dht. updated demo and updated demo to work with a torrent that ubuntu still supports. Demo works as a bittorrent client 2026-06-28 23:26:00 +01:00
Darren Horrocks 69e795cb00 Fix UTMetadata assembling metadata pieces in arrival order
Pieces can arrive out of order, but the old code concatenated them
as they arrived, corrupting the reconstructed metadata. Now the buffer
is pre-allocated to the full metadata_size on handshake and each piece
is written at its correct byte offset (pieceIndex * 16384). Duplicate
and out-of-range pieces are ignored.
2026-06-28 00:20:49 +01:00
Darren Horrocks 3a476fca87 Fix NullReferenceException in Connected property after Disconnect
Disconnect() sets socket to null, but Connected read socket.Connected
without a null guard. Calling Connected (or Process which checks it)
after Disconnect would throw. Added null check on socket first.
2026-06-28 00:20:49 +01:00
Darren Horrocks 6ac974fc28 Fix LocalPeerDiscovery always reporting peer address as 0.0.0.0
EndReceiveFrom fills the ref parameter passed to it (internalRemoteEP)
with the actual sender address. The outer endPoint passed to
BeginReceiveFrom is not updated by the async pattern. Using endPoint
instead of internalRemoteEP caused NewPeer to always fire with 0.0.0.0.
2026-06-28 00:20:49 +01:00
Darren Horrocks 9de17ee20a Fix UDP tracker scrape corrupting the connection ID
BEP 15 scrape responses contain only action, transaction_id, and
per-hash stats — there is no connection ID in the response. Bytes 8–15
are the first hash's seeder/completed counts, not a new connection ID.
Saving them overwrote _currentConnectionId with garbage.
2026-06-28 00:20:49 +01:00
Darren Horrocks b82d3c50ad Fix UDP tracker URL parsing when no port is specified
Groups.Count is always 3 (full match + 2 capture groups) regardless of
whether the port group matched. When a URL like udp://tracker.example.com/
is used, Groups[2].Value is empty and Convert.ToInt32("") throws.
Use Groups[2].Success to correctly detect whether a port was present.
2026-06-28 00:20:49 +01:00
Darren Horrocks d2e067782e Fix peer IP address endianness in compact peer format parsing
BEP 23 specifies that IP addresses in the compact peer format are in
network byte order (big-endian). Both HTTP and UDP tracker clients were
using little-endian, reversing every peer IP (e.g. 1.2.3.4 → 4.3.2.1).
2026-06-28 00:20:49 +01:00
Darren Horrocks 1950469900 Fix bitfield bit ordering to match BitTorrent protocol spec
The protocol requires MSB-first ordering (piece 0 = bit 7 of byte 0),
but both BitfieldParser and SendBitField were using LSB-first (1 << bit).
This caused every piece index to map to the wrong bit when communicating
with any real BitTorrent client.
2026-06-28 00:20:49 +01:00
Darren Horrocks e78a1cc228 Update FUNDING.yml 2026-06-12 23:56:56 +01:00
Darren Horrocks 8b7534acb6 cleaning up some old code 2026-02-04 21:55:11 +00:00
Darren Horrocks 8c6e4741c1 various fixes 2026-02-01 17:59:28 +00:00
Darren Horrocks eb3d94941b large refactor 2025-11-13 00:15:11 +00:00
Darren Horrocks b424750461 bitfield tests 2025-11-12 22:58:31 +00:00
Darren Horrocks 22f5019b26 extra git ignore 2025-11-12 22:58:23 +00:00
Darren Horrocks e6419e2f57 more refactoring, and test fixing 2025-11-12 22:51:59 +00:00
Darren Horrocks b856848ada cleanup/refactoring 2025-11-12 22:35:38 +00:00
Darren Horrocks e2ec148b44 minor refactoring 2024-12-14 00:44:06 +00:00
Darren Horrocks bb9da41cc6 Merge pull request #40 from bizzehdee/dependabot/nuget/Microsoft.NET.Test.Sdk-17.8.0
Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0
2023-12-08 14:13:02 +00:00
dependabot[bot] 6b8e03cc68 Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.2 to 17.8.0.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](https://github.com/microsoft/vstest/compare/v17.7.2...v17.8.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-08 14:12:50 +00:00
Darren Horrocks 7486d7c1f0 Merge pull request #41 from bizzehdee/dependabot/nuget/xunit-2.6.2
Bump xunit from 2.5.2 to 2.6.2
2023-12-08 14:12:42 +00:00
dependabot[bot] 962b33cf3e Bump xunit from 2.5.2 to 2.6.2
Bumps [xunit](https://github.com/xunit/xunit) from 2.5.2 to 2.6.2.
- [Commits](https://github.com/xunit/xunit/compare/2.5.2...2.6.2)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-08 14:12:35 +00:00
Darren Horrocks 93c34a7772 Merge pull request #42 from bizzehdee/dependabot/nuget/System.Text.Encoding.CodePages-8.0.0
Bump System.Text.Encoding.CodePages from 7.0.0 to 8.0.0
2023-12-08 14:12:27 +00:00
Darren Horrocks 5f6e4e7f28 Merge pull request #43 from bizzehdee/dependabot/nuget/xunit.runner.visualstudio-2.5.4
Bump xunit.runner.visualstudio from 2.4.3 to 2.5.4
2023-12-08 14:12:19 +00:00
Darren Horrocks 7f059d3b29 Merge pull request #44 from bizzehdee/dependabot/nuget/xunit.runner.console-2.6.2
Bump xunit.runner.console from 2.4.1 to 2.6.2
2023-12-08 14:11:41 +00:00
dependabot[bot] c48def4f51 Bump xunit.runner.console from 2.4.1 to 2.6.2
Bumps [xunit.runner.console](https://github.com/xunit/xunit) from 2.4.1 to 2.6.2.
- [Commits](https://github.com/xunit/xunit/compare/2.4.1...2.6.2)

---
updated-dependencies:
- dependency-name: xunit.runner.console
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 14:28:53 +00:00
dependabot[bot] 22e9e02f33 Bump xunit.runner.visualstudio from 2.4.3 to 2.5.4
Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.4.3 to 2.5.4.
- [Release notes](https://github.com/xunit/visualstudio.xunit/releases)
- [Commits](https://github.com/xunit/visualstudio.xunit/compare/v2.4.3...2.5.4)

---
updated-dependencies:
- dependency-name: xunit.runner.visualstudio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 14:28:49 +00:00
dependabot[bot] 87a9026462 Bump System.Text.Encoding.CodePages from 7.0.0 to 8.0.0
Bumps [System.Text.Encoding.CodePages](https://github.com/dotnet/runtime) from 7.0.0 to 8.0.0.
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v7.0.0...v8.0.0)

---
updated-dependencies:
- dependency-name: System.Text.Encoding.CodePages
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 14:28:45 +00:00
Darren Horrocks ef8ff3fd7a converting events to use delegates instead of Action's 2023-11-06 22:32:38 +00:00
Darren Horrocks 4786ef67aa Local peer discovery converted to use ISocket 2023-11-06 21:53:21 +00:00
Darren Horrocks 3957737289 minor refactors 2023-11-06 00:03:21 +00:00
Darren Horrocks 74e174a245 waning message 2023-11-04 21:13:35 +00:00
Darren Horrocks a7abf05f77 Merge pull request #37 from bizzehdee/feature/consolidate-peer-wire-connections
consolidate peer wire connections
2023-11-02 23:36:13 +00:00
Darren Horrocks dbe6ff1a87 WIP: peer wire connections are now a single connection. sockets denote the protocol 2023-11-02 23:20:36 +00:00
Darren Horrocks acdeab461c utpsocket implementation 2023-10-29 23:41:41 +00:00
Darren Horrocks 7175f93eb5 WIP for UTP Socket 2023-10-28 22:50:15 +01:00
Darren Horrocks 2da4536bd8 start consolidation 2023-10-28 00:33:18 +01:00
Darren Horrocks 6a86f8945c add licence 2023-10-28 00:33:09 +01:00
Darren Horrocks 582995ca07 Merge pull request #36 from bizzehdee/feature/socket-abstraction-v2
abstracted the required methods of System.Net.Sockets Socket
2023-10-27 23:22:48 +01:00
Darren Horrocks 5b9d57a20c abstracted the required methods of System.Net.Sockets Socket 2023-10-27 23:19:07 +01:00
Darren Horrocks eeb45e2769 updates to test/demo app 2023-10-23 21:41:24 +01:00
Darren Horrocks d87602845f additional fixes 2023-10-23 21:40:50 +01:00
Darren Horrocks f8e646a0fd more tests 2023-10-21 22:51:25 +01:00
Darren Horrocks b82d946af3 fix threading/concurrency issue in TCP connection 2023-10-21 00:09:43 +01:00
Darren Horrocks 35f71c7534 possible not enough data bug in PWP 2023-10-21 00:09:29 +01:00
Darren Horrocks 42064bf1ed more testing 2023-10-20 22:45:43 +01:00
Darren Horrocks aa817248a4 more unit tests 2023-10-20 15:18:22 +01:00
Darren Horrocks 7e426c8e36 unit tests plus minor fixes 2023-10-17 22:34:49 +01:00