From e7dfe97c6df90aaf4d3ca752cddc42f4b882d683 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:30:56 +0000
Subject: [PATCH 01/25] refactor!: remove TSend generic parameter from
SendAndReceiveAsync
---
TcpDotNet.ClientIntegrationTest/Program.cs | 4 ++--
TcpDotNet/BaseClientNode.cs | 4 +---
TcpDotNet/ProtocolClient.cs | 2 +-
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/TcpDotNet.ClientIntegrationTest/Program.cs b/TcpDotNet.ClientIntegrationTest/Program.cs
index ada9729..0ecd968 100644
--- a/TcpDotNet.ClientIntegrationTest/Program.cs
+++ b/TcpDotNet.ClientIntegrationTest/Program.cs
@@ -1,4 +1,4 @@
-using System.Net;
+using System.Net;
using TcpDotNet;
using TcpDotNet.ClientIntegrationTest;
using TcpDotNet.ClientIntegrationTest.PacketHandlers;
@@ -17,7 +17,7 @@ Console.WriteLine($"Connected to {client.RemoteEndPoint}. My session is {client.
var ping = new PingPacket();
Console.WriteLine($"Sending ping packet with payload: {BitConverter.ToString(ping.Payload)}");
-var pong = await client.SendAndReceiveAsync(ping);
+var pong = await client.SendAndReceiveAsync(ping);
Console.WriteLine($"Received pong packet with payload: {BitConverter.ToString(pong.Payload)}");
Console.WriteLine(pong.Payload.SequenceEqual(ping.Payload) ? "Payload matches!" : "Payload does not match!");
diff --git a/TcpDotNet/BaseClientNode.cs b/TcpDotNet/BaseClientNode.cs
index 9670bb0..c1df784 100644
--- a/TcpDotNet/BaseClientNode.cs
+++ b/TcpDotNet/BaseClientNode.cs
@@ -221,15 +221,13 @@ public abstract class BaseClientNode : Node
///
/// The packet to send.
/// A cancellation token that can be used to cancel the asynchronous operation.
- /// The type of the packet to send.
/// The type of the packet to return.
/// The received packet.
///
/// This method will consume all incoming packets, raising their associated handlers if such packets are recognised.
///
- public async Task SendAndReceiveAsync(TSend packetToSend,
+ public async Task SendAndReceiveAsync(Packet packetToSend,
CancellationToken cancellationToken = default)
- where TSend : Packet
where TReceive : Packet
{
var attribute = typeof(TReceive).GetCustomAttribute();
diff --git a/TcpDotNet/ProtocolClient.cs b/TcpDotNet/ProtocolClient.cs
index 1294eb8..ff9979b 100644
--- a/TcpDotNet/ProtocolClient.cs
+++ b/TcpDotNet/ProtocolClient.cs
@@ -96,7 +96,7 @@ public sealed class ProtocolClient : BaseClientNode
State = ClientState.Handshaking;
var handshakeRequest = new HandshakeRequestPacket(ProtocolVersion);
var handshakeResponse =
- await SendAndReceiveAsync(handshakeRequest, cancellationToken);
+ await SendAndReceiveAsync(handshakeRequest, cancellationToken);
if (handshakeResponse.HandshakeResponse != HandshakeResponse.Success)
{
From 259fdddd6ee3c6a7ff0fa546ed675089aff508c0 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:32:29 +0000
Subject: [PATCH 02/25] refactor!: rename BaseClientNode to ClientNode
---
.../PacketHandlers/GoodbyePacketHandler.cs | 2 +-
.../PacketHandlers/HelloPacketHandler.cs | 2 +-
TcpDotNet.ListenerIntegrationTest/Program.cs | 2 +-
TcpDotNet/{BaseClientNode.cs => ClientNode.cs} | 6 +++---
TcpDotNet/ClientState.cs | 2 +-
TcpDotNet/Protocol/PacketHandler.cs | 8 ++++----
.../Protocol/PacketHandlers/DisconnectPacketHandler.cs | 2 +-
.../PacketHandlers/EncryptionResponsePacketHandler.cs | 2 +-
.../PacketHandlers/HandshakeRequestPacketHandler.cs | 2 +-
TcpDotNet/ProtocolClient.cs | 2 +-
TcpDotNet/ProtocolListener.Client.cs | 2 +-
11 files changed, 16 insertions(+), 16 deletions(-)
rename TcpDotNet/{BaseClientNode.cs => ClientNode.cs} (98%)
diff --git a/TcpDotNet.ClientIntegrationTest/PacketHandlers/GoodbyePacketHandler.cs b/TcpDotNet.ClientIntegrationTest/PacketHandlers/GoodbyePacketHandler.cs
index 243aa78..5277031 100644
--- a/TcpDotNet.ClientIntegrationTest/PacketHandlers/GoodbyePacketHandler.cs
+++ b/TcpDotNet.ClientIntegrationTest/PacketHandlers/GoodbyePacketHandler.cs
@@ -4,7 +4,7 @@ namespace TcpDotNet.ClientIntegrationTest.PacketHandlers;
internal sealed class GoodbyePacketHandler : PacketHandler
{
- public override Task HandleAsync(BaseClientNode recipient, GoodbyePacket packet, CancellationToken cancellationToken = default)
+ public override Task HandleAsync(ClientNode recipient, GoodbyePacket packet, CancellationToken cancellationToken = default)
{
Console.WriteLine($"Server sent {packet.Message}");
return Task.CompletedTask;
diff --git a/TcpDotNet.ListenerIntegrationTest/PacketHandlers/HelloPacketHandler.cs b/TcpDotNet.ListenerIntegrationTest/PacketHandlers/HelloPacketHandler.cs
index f181fea..20646a0 100644
--- a/TcpDotNet.ListenerIntegrationTest/PacketHandlers/HelloPacketHandler.cs
+++ b/TcpDotNet.ListenerIntegrationTest/PacketHandlers/HelloPacketHandler.cs
@@ -4,7 +4,7 @@ namespace TcpDotNet.ListenerIntegrationTest.PacketHandlers;
internal sealed class HelloPacketHandler : PacketHandler
{
- public override Task HandleAsync(BaseClientNode recipient, HelloPacket packet, CancellationToken cancellationToken = default)
+ public override Task HandleAsync(ClientNode recipient, HelloPacket packet, CancellationToken cancellationToken = default)
{
Console.WriteLine($"Client sent {packet.Message}");
return recipient.SendPacketAsync(new GoodbyePacket {Message = "Goodbye!"}, cancellationToken);
diff --git a/TcpDotNet.ListenerIntegrationTest/Program.cs b/TcpDotNet.ListenerIntegrationTest/Program.cs
index 8f88848..b0a3829 100644
--- a/TcpDotNet.ListenerIntegrationTest/Program.cs
+++ b/TcpDotNet.ListenerIntegrationTest/Program.cs
@@ -16,7 +16,7 @@ await Task.Delay(-1);
internal sealed class PingPacketHandler : PacketHandler
{
- public override async Task HandleAsync(BaseClientNode recipient, PingPacket packet, CancellationToken cancellationToken = default)
+ public override async Task HandleAsync(ClientNode recipient, PingPacket packet, CancellationToken cancellationToken = default)
{
Console.WriteLine($"Client {recipient.SessionId} sent ping with payload {BitConverter.ToString(packet.Payload)}");
var pong = new PongPacket(packet.CallbackId, packet.Payload);
diff --git a/TcpDotNet/BaseClientNode.cs b/TcpDotNet/ClientNode.cs
similarity index 98%
rename from TcpDotNet/BaseClientNode.cs
rename to TcpDotNet/ClientNode.cs
index c1df784..546dcb3 100644
--- a/TcpDotNet/BaseClientNode.cs
+++ b/TcpDotNet/ClientNode.cs
@@ -13,16 +13,16 @@ namespace TcpDotNet;
///
/// Represents a client node.
///
-public abstract class BaseClientNode : Node
+public abstract class ClientNode : Node
{
private readonly ObjectIDGenerator _callbackIdGenerator = new();
private readonly ConcurrentDictionary>> _packetCompletionSources = new();
private EndPoint? _remoteEP;
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
- protected BaseClientNode()
+ protected ClientNode()
{
}
diff --git a/TcpDotNet/ClientState.cs b/TcpDotNet/ClientState.cs
index 01532ba..7fe88b8 100644
--- a/TcpDotNet/ClientState.cs
+++ b/TcpDotNet/ClientState.cs
@@ -1,7 +1,7 @@
namespace TcpDotNet;
///
-/// An enumeration of states for a to be in.
+/// An enumeration of states for a to be in.
///
public enum ClientState
{
diff --git a/TcpDotNet/Protocol/PacketHandler.cs b/TcpDotNet/Protocol/PacketHandler.cs
index c303e27..825363f 100644
--- a/TcpDotNet/Protocol/PacketHandler.cs
+++ b/TcpDotNet/Protocol/PacketHandler.cs
@@ -12,7 +12,7 @@ public abstract class PacketHandler
/// The recipient of the packet.
/// The packet to handle.
/// A cancellation token that can be used to cancel the asynchronous operation.
- public abstract Task HandleAsync(BaseClientNode recipient, Packet packet, CancellationToken cancellationToken = default);
+ public abstract Task HandleAsync(ClientNode recipient, Packet packet, CancellationToken cancellationToken = default);
}
///
@@ -27,7 +27,7 @@ public abstract class PacketHandler : PacketHandler
public static readonly PacketHandler Empty = new NullPacketHandler();
///
- public override Task HandleAsync(BaseClientNode recipient, Packet packet, CancellationToken cancellationToken = default)
+ public override Task HandleAsync(ClientNode recipient, Packet packet, CancellationToken cancellationToken = default)
{
if (packet is T actual) return HandleAsync(recipient, actual, cancellationToken);
return Task.CompletedTask;
@@ -39,7 +39,7 @@ public abstract class PacketHandler : PacketHandler
/// The recipient of the packet.
/// The packet to handle.
/// A cancellation token that can be used to cancel the asynchronous operation.
- public abstract Task HandleAsync(BaseClientNode recipient, T packet, CancellationToken cancellationToken = default);
+ public abstract Task HandleAsync(ClientNode recipient, T packet, CancellationToken cancellationToken = default);
}
///
@@ -50,7 +50,7 @@ internal sealed class NullPacketHandler : PacketHandler
where T : Packet
{
///
- public override Task HandleAsync(BaseClientNode recipient, T packet, CancellationToken cancellationToken = default)
+ public override Task HandleAsync(ClientNode recipient, T packet, CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}
diff --git a/TcpDotNet/Protocol/PacketHandlers/DisconnectPacketHandler.cs b/TcpDotNet/Protocol/PacketHandlers/DisconnectPacketHandler.cs
index 0107ba9..ea9ce27 100644
--- a/TcpDotNet/Protocol/PacketHandlers/DisconnectPacketHandler.cs
+++ b/TcpDotNet/Protocol/PacketHandlers/DisconnectPacketHandler.cs
@@ -6,7 +6,7 @@ internal sealed class DisconnectPacketHandler : PacketHandler
{
///
public override Task HandleAsync(
- BaseClientNode recipient,
+ ClientNode recipient,
DisconnectPacket packet,
CancellationToken cancellationToken = default
)
diff --git a/TcpDotNet/Protocol/PacketHandlers/EncryptionResponsePacketHandler.cs b/TcpDotNet/Protocol/PacketHandlers/EncryptionResponsePacketHandler.cs
index c79914a..0a6194a 100644
--- a/TcpDotNet/Protocol/PacketHandlers/EncryptionResponsePacketHandler.cs
+++ b/TcpDotNet/Protocol/PacketHandlers/EncryptionResponsePacketHandler.cs
@@ -11,7 +11,7 @@ internal sealed class EncryptionResponsePacketHandler : PacketHandler
public override async Task HandleAsync(
- BaseClientNode recipient,
+ ClientNode recipient,
EncryptionResponsePacket packet,
CancellationToken cancellationToken = default
)
diff --git a/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs b/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
index 2df88d0..9ec2a75 100644
--- a/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
+++ b/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
@@ -10,7 +10,7 @@ internal sealed class HandshakeRequestPacketHandler : PacketHandler
public override async Task HandleAsync(
- BaseClientNode recipient,
+ ClientNode recipient,
HandshakeRequestPacket packet,
CancellationToken cancellationToken = default
)
diff --git a/TcpDotNet/ProtocolClient.cs b/TcpDotNet/ProtocolClient.cs
index ff9979b..e510ca3 100644
--- a/TcpDotNet/ProtocolClient.cs
+++ b/TcpDotNet/ProtocolClient.cs
@@ -14,7 +14,7 @@ namespace TcpDotNet;
///
/// Represents a client on the TcpDotNet protocol.
///
-public sealed class ProtocolClient : BaseClientNode
+public sealed class ProtocolClient : ClientNode
{
///
/// Initializes a new instance of the class.
diff --git a/TcpDotNet/ProtocolListener.Client.cs b/TcpDotNet/ProtocolListener.Client.cs
index 2755a31..3c834c4 100644
--- a/TcpDotNet/ProtocolListener.Client.cs
+++ b/TcpDotNet/ProtocolListener.Client.cs
@@ -8,7 +8,7 @@ public sealed partial class ProtocolListener
///
/// Represents a client that is connected to a .
///
- public sealed class Client : BaseClientNode
+ public sealed class Client : ClientNode
{
internal Client(ProtocolListener listener, Socket socket)
{
From ed279cfd69bc8414c15313e34aaf08bcaece4c42 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:33:56 +0000
Subject: [PATCH 03/25] feat: add .net 8 target
---
.../TcpDotNet.ClientIntegrationTest.csproj | 2 +-
.../TcpDotNet.ListenerIntegrationTest.csproj | 2 +-
TcpDotNet/TcpDotNet.csproj | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/TcpDotNet.ClientIntegrationTest/TcpDotNet.ClientIntegrationTest.csproj b/TcpDotNet.ClientIntegrationTest/TcpDotNet.ClientIntegrationTest.csproj
index ed854e8..8532d3c 100644
--- a/TcpDotNet.ClientIntegrationTest/TcpDotNet.ClientIntegrationTest.csproj
+++ b/TcpDotNet.ClientIntegrationTest/TcpDotNet.ClientIntegrationTest.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
enable
enable
diff --git a/TcpDotNet.ListenerIntegrationTest/TcpDotNet.ListenerIntegrationTest.csproj b/TcpDotNet.ListenerIntegrationTest/TcpDotNet.ListenerIntegrationTest.csproj
index ed854e8..8532d3c 100644
--- a/TcpDotNet.ListenerIntegrationTest/TcpDotNet.ListenerIntegrationTest.csproj
+++ b/TcpDotNet.ListenerIntegrationTest/TcpDotNet.ListenerIntegrationTest.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
enable
enable
diff --git a/TcpDotNet/TcpDotNet.csproj b/TcpDotNet/TcpDotNet.csproj
index 3e8b637..aa54b53 100644
--- a/TcpDotNet/TcpDotNet.csproj
+++ b/TcpDotNet/TcpDotNet.csproj
@@ -1,7 +1,7 @@
- netstandard2.1;net6.0;net7.0
+ netstandard2.1;net6.0;net7.0;net8.0
enable
enable
10
From 32fecb5ace202ed40d1178a194f705b1a6a7054c Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:35:44 +0000
Subject: [PATCH 04/25] fix: pass in not ref with net8.0 to
MemoryMarshal.TryWrite
---
TcpDotNet/Protocol/ProtocolWriter.cs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/TcpDotNet/Protocol/ProtocolWriter.cs b/TcpDotNet/Protocol/ProtocolWriter.cs
index 76280fe..138bee6 100644
--- a/TcpDotNet/Protocol/ProtocolWriter.cs
+++ b/TcpDotNet/Protocol/ProtocolWriter.cs
@@ -1,4 +1,4 @@
-using System.Net;
+using System.Net;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
@@ -38,7 +38,11 @@ public sealed class ProtocolWriter : BinaryWriter
public override void Write(double value)
{
Span buffer = stackalloc byte[8];
+#if NET8_0_OR_GREATER
+ MemoryMarshal.TryWrite(buffer, in value);
+#else
MemoryMarshal.TryWrite(buffer, ref value);
+#endif
if (BitConverter.IsLittleEndian) buffer.Reverse();
Write(buffer);
@@ -89,7 +93,11 @@ public sealed class ProtocolWriter : BinaryWriter
public override void Write(float value)
{
Span buffer = stackalloc byte[4];
+#if NET8_0_OR_GREATER
+ MemoryMarshal.TryWrite(buffer, in value);
+#else
MemoryMarshal.TryWrite(buffer, ref value);
+#endif
if (BitConverter.IsLittleEndian) buffer.Reverse();
Write(buffer);
From 0c5c2087b93c6dedc70dc4ba1879be57962d12f1 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:40:15 +0000
Subject: [PATCH 05/25] [ci skip] style: run code cleanup
---
TcpDotNet/ClientNode.cs | 12 ++++++-----
TcpDotNet/Node.cs | 6 ++++--
.../HandshakeRequestPacketHandler.cs | 3 ++-
.../Packets/ClientBound/DisconnectPacket.cs | 4 ++--
.../ClientBound/HandshakeResponsePacket.cs | 4 ++--
TcpDotNet/Protocol/ProtocolReader.cs | 18 ++++++++---------
TcpDotNet/Protocol/ProtocolWriter.cs | 20 +++++++++----------
TcpDotNet/ProtocolListener.Client.cs | 3 ++-
8 files changed, 38 insertions(+), 32 deletions(-)
diff --git a/TcpDotNet/ClientNode.cs b/TcpDotNet/ClientNode.cs
index 546dcb3..13b1738 100644
--- a/TcpDotNet/ClientNode.cs
+++ b/TcpDotNet/ClientNode.cs
@@ -148,7 +148,7 @@ public abstract class ClientNode : Node
if (constructor is null)
return null;
- var packet = (Packet) constructor.Invoke(null);
+ var packet = (Packet)constructor.Invoke(null);
packet.Deserialize(bufferReader);
await targetStream.DisposeAsync();
@@ -198,7 +198,7 @@ public abstract class ClientNode : Node
buffer.Position = 0;
}
- var length = (int) buffer.Length;
+ var length = (int)buffer.Length;
networkWriter.Write(length);
try
@@ -239,7 +239,8 @@ public abstract class ClientNode : Node
requestPacket.CallbackId = _callbackIdGenerator.GetId(packetToSend, out _);
var completionSource = new TaskCompletionSource();
- if (!_packetCompletionSources.TryGetValue(attribute.Id, out List>? completionSources))
+ if (!_packetCompletionSources.TryGetValue(attribute.Id,
+ out List>? completionSources))
{
completionSources = new List>();
_packetCompletionSources.TryAdd(attribute.Id, completionSources);
@@ -292,7 +293,8 @@ public abstract class ClientNode : Node
if (attribute is null)
throw new ArgumentException($"The packet type {typeof(TPacket).Name} is not a valid packet.");
- if (!_packetCompletionSources.TryGetValue(attribute.Id, out List>? completionSources))
+ if (!_packetCompletionSources.TryGetValue(attribute.Id,
+ out List>? completionSources))
{
completionSources = new List>();
_packetCompletionSources.TryAdd(attribute.Id, completionSources);
@@ -326,7 +328,7 @@ public abstract class ClientNode : Node
completionSource.SetCanceled();
}, cancellationToken);
- var packet = (TPacket) await Task.Run(() => completionSource.Task, cancellationToken);
+ var packet = (TPacket)await Task.Run(() => completionSource.Task, cancellationToken);
if (_packetCompletionSources.TryGetValue(attribute.Id, out completionSources))
{
lock (completionSources)
diff --git a/TcpDotNet/Node.cs b/TcpDotNet/Node.cs
index bdcf759..ed50de5 100644
--- a/TcpDotNet/Node.cs
+++ b/TcpDotNet/Node.cs
@@ -38,7 +38,8 @@ public abstract class Node : IDisposable
/// The registered packets.
public IReadOnlyDictionary> RegisteredPacketHandlers =>
new ReadOnlyDictionary>(
- _registeredPacketHandlers.ToDictionary(p => p.Key, p => (IReadOnlyCollection) p.Value.AsReadOnly()));
+ _registeredPacketHandlers.ToDictionary(p => p.Key,
+ p => (IReadOnlyCollection)p.Value.AsReadOnly()));
///
/// Closes the base socket connection and releases all associated resources.
@@ -124,7 +125,8 @@ public abstract class Node : IDisposable
var attribute = packetType.GetCustomAttribute();
if (attribute is null) throw new ArgumentException($"{packetType.Name} is not a valid packet.");
if (_registeredPackets.TryGetValue(attribute.Id, out Type? registeredPacket))
- throw new ArgumentException($"The packet type {attribute.Id:X8} is already registered to {registeredPacket.Name}.");
+ throw new ArgumentException(
+ $"The packet type {attribute.Id:X8} is already registered to {registeredPacket.Name}.");
_registeredPackets.TryAdd(attribute.Id, packetType);
}
diff --git a/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs b/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
index 9ec2a75..d37209d 100644
--- a/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
+++ b/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
@@ -22,7 +22,8 @@ internal sealed class HandshakeRequestPacketHandler : PacketHandler
protected internal override void Deserialize(ProtocolReader reader)
{
- Reason = (DisconnectReason) reader.ReadByte();
+ Reason = (DisconnectReason)reader.ReadByte();
}
///
protected internal override void Serialize(ProtocolWriter writer)
{
- writer.Write((byte) Reason);
+ writer.Write((byte)Reason);
}
}
diff --git a/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs b/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs
index 0cc020e..8fcf1a8 100644
--- a/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs
+++ b/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs
@@ -38,14 +38,14 @@ internal sealed class HandshakeResponsePacket : Packet
///
protected internal override void Deserialize(ProtocolReader reader)
{
- HandshakeResponse = (HandshakeResponse) reader.ReadByte();
+ HandshakeResponse = (HandshakeResponse)reader.ReadByte();
ProtocolVersion = reader.ReadInt32();
}
///
protected internal override void Serialize(ProtocolWriter writer)
{
- writer.Write((byte) HandshakeResponse);
+ writer.Write((byte)HandshakeResponse);
writer.Write(ProtocolVersion);
}
}
diff --git a/TcpDotNet/Protocol/ProtocolReader.cs b/TcpDotNet/Protocol/ProtocolReader.cs
index 810613d..36df3bb 100644
--- a/TcpDotNet/Protocol/ProtocolReader.cs
+++ b/TcpDotNet/Protocol/ProtocolReader.cs
@@ -66,7 +66,7 @@ public sealed class ProtocolReader : BinaryReader
result |= (byteReadJustNow & 0x7Fu) << shift;
if (byteReadJustNow <= 0x7Fu)
- return (int) result; // early exit
+ return (int)result; // early exit
}
// Read the 5th byte. Since we already read 28 bits,
@@ -77,8 +77,8 @@ public sealed class ProtocolReader : BinaryReader
if (byteReadJustNow > 0b_1111u)
throw new FormatException();
- result |= (uint) byteReadJustNow << (maxBytesWithoutOverflow * 7);
- return (int) result;
+ result |= (uint)byteReadJustNow << (maxBytesWithoutOverflow * 7);
+ return (int)result;
}
///
@@ -107,7 +107,7 @@ public sealed class ProtocolReader : BinaryReader
result |= (byteReadJustNow & 0x7Ful) << shift;
if (byteReadJustNow <= 0x7Fu)
- return (long) result; // early exit
+ return (long)result; // early exit
}
// Read the 10th byte. Since we already read 63 bits,
@@ -118,8 +118,8 @@ public sealed class ProtocolReader : BinaryReader
if (byteReadJustNow > 0b_1u)
throw new FormatException();
- result |= (ulong) byteReadJustNow << (maxBytesWithoutOverflow * 7);
- return (long) result;
+ result |= (ulong)byteReadJustNow << (maxBytesWithoutOverflow * 7);
+ return (long)result;
}
///
@@ -196,21 +196,21 @@ public sealed class ProtocolReader : BinaryReader
[CLSCompliant(false)]
public override ushort ReadUInt16()
{
- return (ushort) IPAddress.NetworkToHostOrder((short) base.ReadUInt16());
+ return (ushort)IPAddress.NetworkToHostOrder((short)base.ReadUInt16());
}
///
[CLSCompliant(false)]
public override uint ReadUInt32()
{
- return (uint) IPAddress.NetworkToHostOrder((int) base.ReadUInt32());
+ return (uint)IPAddress.NetworkToHostOrder((int)base.ReadUInt32());
}
///
[CLSCompliant(false)]
public override ulong ReadUInt64()
{
- return (ulong) IPAddress.NetworkToHostOrder((long) base.ReadUInt64());
+ return (ulong)IPAddress.NetworkToHostOrder((long)base.ReadUInt64());
}
///
diff --git a/TcpDotNet/Protocol/ProtocolWriter.cs b/TcpDotNet/Protocol/ProtocolWriter.cs
index 138bee6..f667a30 100644
--- a/TcpDotNet/Protocol/ProtocolWriter.cs
+++ b/TcpDotNet/Protocol/ProtocolWriter.cs
@@ -1,4 +1,4 @@
-using System.Net;
+using System.Net;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
@@ -107,21 +107,21 @@ public sealed class ProtocolWriter : BinaryWriter
[CLSCompliant(false)]
public override void Write(ushort value)
{
- base.Write((ushort) IPAddress.HostToNetworkOrder((short) value));
+ base.Write((ushort)IPAddress.HostToNetworkOrder((short)value));
}
///
[CLSCompliant(false)]
public override void Write(uint value)
{
- base.Write((uint) IPAddress.HostToNetworkOrder((int) value));
+ base.Write((uint)IPAddress.HostToNetworkOrder((int)value));
}
///
[CLSCompliant(false)]
public override void Write(ulong value)
{
- base.Write((ulong) IPAddress.HostToNetworkOrder((long) value));
+ base.Write((ulong)IPAddress.HostToNetworkOrder((long)value));
}
///
@@ -163,7 +163,7 @@ public sealed class ProtocolWriter : BinaryWriter
/// The 32-bit integer to be written.
public void Write7BitEncodedInt32(int value)
{
- var uValue = (uint) value;
+ var uValue = (uint)value;
// Write out an int 7 bits at a time. The high bit of the byte,
// when on, tells reader to continue reading more bytes.
@@ -173,11 +173,11 @@ public sealed class ProtocolWriter : BinaryWriter
while (uValue > 0x7Fu)
{
- Write((byte) (uValue | ~0x7Fu));
+ Write((byte)(uValue | ~0x7Fu));
uValue >>= 7;
}
- Write((byte) uValue);
+ Write((byte)uValue);
}
///
@@ -186,7 +186,7 @@ public sealed class ProtocolWriter : BinaryWriter
/// The 64-bit integer to be written.
public void Write7BitEncodedInt64(long value)
{
- var uValue = (ulong) value;
+ var uValue = (ulong)value;
// Write out an int 7 bits at a time. The high bit of the byte,
// when on, tells reader to continue reading more bytes.
@@ -196,10 +196,10 @@ public sealed class ProtocolWriter : BinaryWriter
while (uValue > 0x7Fu)
{
- Write((byte) ((uint) uValue | ~0x7Fu));
+ Write((byte)((uint)uValue | ~0x7Fu));
uValue >>= 7;
}
- Write((byte) uValue);
+ Write((byte)uValue);
}
}
diff --git a/TcpDotNet/ProtocolListener.Client.cs b/TcpDotNet/ProtocolListener.Client.cs
index 3c834c4..2364d1b 100644
--- a/TcpDotNet/ProtocolListener.Client.cs
+++ b/TcpDotNet/ProtocolListener.Client.cs
@@ -35,7 +35,8 @@ public sealed partial class ProtocolListener
foreach (Type packetType in ParentListener.RegisteredPackets.Values)
RegisterPacket(packetType);
- foreach ((Type packetType, IReadOnlyCollection? handlers) in ParentListener.RegisteredPacketHandlers)
+ foreach ((Type packetType, IReadOnlyCollection? handlers) in ParentListener
+ .RegisteredPacketHandlers)
foreach (PacketHandler handler in handlers)
RegisterPacketHandler(packetType, handler);
From d7ba24e302757269b9d8198c501024874543bca8 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:41:52 +0000
Subject: [PATCH 06/25] style: remove UTF-8 BOM
---
TcpDotNet.ClientIntegrationTest/GoodbyePacket.cs | 2 +-
TcpDotNet.ClientIntegrationTest/HelloPacket.cs | 2 +-
.../PacketHandlers/GoodbyePacketHandler.cs | 2 +-
TcpDotNet.ListenerIntegrationTest/GoodbyePacket.cs | 2 +-
TcpDotNet.ListenerIntegrationTest/HelloPacket.cs | 2 +-
.../PacketHandlers/HelloPacketHandler.cs | 2 +-
TcpDotNet.ListenerIntegrationTest/Program.cs | 2 +-
TcpDotNet/Assembly.cs | 2 +-
TcpDotNet/ClientNode.cs | 2 +-
TcpDotNet/ClientState.cs | 2 +-
TcpDotNet/CryptographyUtils.cs | 2 +-
TcpDotNet/Node.cs | 2 +-
TcpDotNet/Protocol/HandshakeResponse.cs | 2 +-
TcpDotNet/Protocol/Packet.cs | 2 +-
TcpDotNet/Protocol/PacketAttribute.cs | 2 +-
TcpDotNet/Protocol/PacketHandler.cs | 2 +-
TcpDotNet/Protocol/PacketHandlers/DisconnectPacketHandler.cs | 2 +-
.../Protocol/PacketHandlers/EncryptionResponsePacketHandler.cs | 2 +-
.../Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs | 2 +-
TcpDotNet/Protocol/Packets/ClientBound/DisconnectPacket.cs | 2 +-
.../Protocol/Packets/ClientBound/EncryptionRequestPacket.cs | 2 +-
.../Protocol/Packets/ClientBound/HandshakeResponsePacket.cs | 2 +-
TcpDotNet/Protocol/Packets/ClientBound/PongPacket.cs | 2 +-
TcpDotNet/Protocol/Packets/ClientBound/SessionExchangePacket.cs | 2 +-
.../Protocol/Packets/ServerBound/EncryptionResponsePacket.cs | 2 +-
.../Protocol/Packets/ServerBound/HandshakeRequestPacket.cs | 2 +-
TcpDotNet/Protocol/Packets/ServerBound/PingPacket.cs | 2 +-
TcpDotNet/Protocol/ProtocolReader.cs | 2 +-
TcpDotNet/Protocol/ProtocolWriter.cs | 2 +-
TcpDotNet/Protocol/RequestPacket.cs | 2 +-
TcpDotNet/Protocol/ResponsePacket.cs | 2 +-
TcpDotNet/ProtocolClient.cs | 2 +-
TcpDotNet/ProtocolListener.cs | 2 +-
33 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/TcpDotNet.ClientIntegrationTest/GoodbyePacket.cs b/TcpDotNet.ClientIntegrationTest/GoodbyePacket.cs
index d79d97c..9892853 100644
--- a/TcpDotNet.ClientIntegrationTest/GoodbyePacket.cs
+++ b/TcpDotNet.ClientIntegrationTest/GoodbyePacket.cs
@@ -1,4 +1,4 @@
-using TcpDotNet.Protocol;
+using TcpDotNet.Protocol;
namespace TcpDotNet.ClientIntegrationTest;
diff --git a/TcpDotNet.ClientIntegrationTest/HelloPacket.cs b/TcpDotNet.ClientIntegrationTest/HelloPacket.cs
index 0b4f357..0cc4e9f 100644
--- a/TcpDotNet.ClientIntegrationTest/HelloPacket.cs
+++ b/TcpDotNet.ClientIntegrationTest/HelloPacket.cs
@@ -1,4 +1,4 @@
-using TcpDotNet.Protocol;
+using TcpDotNet.Protocol;
namespace TcpDotNet.ClientIntegrationTest;
diff --git a/TcpDotNet.ClientIntegrationTest/PacketHandlers/GoodbyePacketHandler.cs b/TcpDotNet.ClientIntegrationTest/PacketHandlers/GoodbyePacketHandler.cs
index 5277031..58fec4a 100644
--- a/TcpDotNet.ClientIntegrationTest/PacketHandlers/GoodbyePacketHandler.cs
+++ b/TcpDotNet.ClientIntegrationTest/PacketHandlers/GoodbyePacketHandler.cs
@@ -1,4 +1,4 @@
-using TcpDotNet.Protocol;
+using TcpDotNet.Protocol;
namespace TcpDotNet.ClientIntegrationTest.PacketHandlers;
diff --git a/TcpDotNet.ListenerIntegrationTest/GoodbyePacket.cs b/TcpDotNet.ListenerIntegrationTest/GoodbyePacket.cs
index 02baa10..40e03c1 100644
--- a/TcpDotNet.ListenerIntegrationTest/GoodbyePacket.cs
+++ b/TcpDotNet.ListenerIntegrationTest/GoodbyePacket.cs
@@ -1,4 +1,4 @@
-using TcpDotNet.Protocol;
+using TcpDotNet.Protocol;
namespace TcpDotNet.ListenerIntegrationTest;
diff --git a/TcpDotNet.ListenerIntegrationTest/HelloPacket.cs b/TcpDotNet.ListenerIntegrationTest/HelloPacket.cs
index 80a958b..6adb687 100644
--- a/TcpDotNet.ListenerIntegrationTest/HelloPacket.cs
+++ b/TcpDotNet.ListenerIntegrationTest/HelloPacket.cs
@@ -1,4 +1,4 @@
-using TcpDotNet.Protocol;
+using TcpDotNet.Protocol;
namespace TcpDotNet.ListenerIntegrationTest;
diff --git a/TcpDotNet.ListenerIntegrationTest/PacketHandlers/HelloPacketHandler.cs b/TcpDotNet.ListenerIntegrationTest/PacketHandlers/HelloPacketHandler.cs
index 20646a0..f138f55 100644
--- a/TcpDotNet.ListenerIntegrationTest/PacketHandlers/HelloPacketHandler.cs
+++ b/TcpDotNet.ListenerIntegrationTest/PacketHandlers/HelloPacketHandler.cs
@@ -1,4 +1,4 @@
-using TcpDotNet.Protocol;
+using TcpDotNet.Protocol;
namespace TcpDotNet.ListenerIntegrationTest.PacketHandlers;
diff --git a/TcpDotNet.ListenerIntegrationTest/Program.cs b/TcpDotNet.ListenerIntegrationTest/Program.cs
index b0a3829..611cae2 100644
--- a/TcpDotNet.ListenerIntegrationTest/Program.cs
+++ b/TcpDotNet.ListenerIntegrationTest/Program.cs
@@ -1,4 +1,4 @@
-using TcpDotNet;
+using TcpDotNet;
using TcpDotNet.ListenerIntegrationTest.PacketHandlers;
using TcpDotNet.Protocol;
using TcpDotNet.Protocol.Packets.ClientBound;
diff --git a/TcpDotNet/Assembly.cs b/TcpDotNet/Assembly.cs
index f547610..c0d560e 100644
--- a/TcpDotNet/Assembly.cs
+++ b/TcpDotNet/Assembly.cs
@@ -1 +1 @@
-[assembly: CLSCompliant(true)]
+[assembly: CLSCompliant(true)]
diff --git a/TcpDotNet/ClientNode.cs b/TcpDotNet/ClientNode.cs
index 13b1738..6ff6b55 100644
--- a/TcpDotNet/ClientNode.cs
+++ b/TcpDotNet/ClientNode.cs
@@ -1,4 +1,4 @@
-using System.Collections.Concurrent;
+using System.Collections.Concurrent;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
diff --git a/TcpDotNet/ClientState.cs b/TcpDotNet/ClientState.cs
index 7fe88b8..fec2980 100644
--- a/TcpDotNet/ClientState.cs
+++ b/TcpDotNet/ClientState.cs
@@ -1,4 +1,4 @@
-namespace TcpDotNet;
+namespace TcpDotNet;
///
/// An enumeration of states for a to be in.
diff --git a/TcpDotNet/CryptographyUtils.cs b/TcpDotNet/CryptographyUtils.cs
index 2907bb9..f1b287a 100644
--- a/TcpDotNet/CryptographyUtils.cs
+++ b/TcpDotNet/CryptographyUtils.cs
@@ -1,4 +1,4 @@
-using Chilkat;
+using Chilkat;
namespace TcpDotNet;
diff --git a/TcpDotNet/Node.cs b/TcpDotNet/Node.cs
index ed50de5..7af3a01 100644
--- a/TcpDotNet/Node.cs
+++ b/TcpDotNet/Node.cs
@@ -1,4 +1,4 @@
-using System.Collections.Concurrent;
+using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Net.Sockets;
using System.Reflection;
diff --git a/TcpDotNet/Protocol/HandshakeResponse.cs b/TcpDotNet/Protocol/HandshakeResponse.cs
index a0a5a30..4534962 100644
--- a/TcpDotNet/Protocol/HandshakeResponse.cs
+++ b/TcpDotNet/Protocol/HandshakeResponse.cs
@@ -1,4 +1,4 @@
-namespace TcpDotNet.Protocol;
+namespace TcpDotNet.Protocol;
///
/// An enumeration of handshake responses.
diff --git a/TcpDotNet/Protocol/Packet.cs b/TcpDotNet/Protocol/Packet.cs
index e984dbc..c1c79ce 100644
--- a/TcpDotNet/Protocol/Packet.cs
+++ b/TcpDotNet/Protocol/Packet.cs
@@ -1,4 +1,4 @@
-using System.Reflection;
+using System.Reflection;
namespace TcpDotNet.Protocol;
diff --git a/TcpDotNet/Protocol/PacketAttribute.cs b/TcpDotNet/Protocol/PacketAttribute.cs
index 8bda278..a613d81 100644
--- a/TcpDotNet/Protocol/PacketAttribute.cs
+++ b/TcpDotNet/Protocol/PacketAttribute.cs
@@ -1,4 +1,4 @@
-namespace TcpDotNet.Protocol;
+namespace TcpDotNet.Protocol;
///
/// Specifies metadata for a .
diff --git a/TcpDotNet/Protocol/PacketHandler.cs b/TcpDotNet/Protocol/PacketHandler.cs
index 825363f..9431b8a 100644
--- a/TcpDotNet/Protocol/PacketHandler.cs
+++ b/TcpDotNet/Protocol/PacketHandler.cs
@@ -1,4 +1,4 @@
-namespace TcpDotNet.Protocol;
+namespace TcpDotNet.Protocol;
///
/// Represents the base class for a packet handler.
diff --git a/TcpDotNet/Protocol/PacketHandlers/DisconnectPacketHandler.cs b/TcpDotNet/Protocol/PacketHandlers/DisconnectPacketHandler.cs
index ea9ce27..b36f755 100644
--- a/TcpDotNet/Protocol/PacketHandlers/DisconnectPacketHandler.cs
+++ b/TcpDotNet/Protocol/PacketHandlers/DisconnectPacketHandler.cs
@@ -1,4 +1,4 @@
-using TcpDotNet.Protocol.Packets.ClientBound;
+using TcpDotNet.Protocol.Packets.ClientBound;
namespace TcpDotNet.Protocol.PacketHandlers;
diff --git a/TcpDotNet/Protocol/PacketHandlers/EncryptionResponsePacketHandler.cs b/TcpDotNet/Protocol/PacketHandlers/EncryptionResponsePacketHandler.cs
index 0a6194a..16dc115 100644
--- a/TcpDotNet/Protocol/PacketHandlers/EncryptionResponsePacketHandler.cs
+++ b/TcpDotNet/Protocol/PacketHandlers/EncryptionResponsePacketHandler.cs
@@ -1,4 +1,4 @@
-using System.Security.Cryptography;
+using System.Security.Cryptography;
using TcpDotNet.Protocol.Packets.ClientBound;
using TcpDotNet.Protocol.Packets.ServerBound;
diff --git a/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs b/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
index d37209d..78a1861 100644
--- a/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
+++ b/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
@@ -1,4 +1,4 @@
-using TcpDotNet.Protocol.Packets.ClientBound;
+using TcpDotNet.Protocol.Packets.ClientBound;
using TcpDotNet.Protocol.Packets.ServerBound;
namespace TcpDotNet.Protocol.PacketHandlers;
diff --git a/TcpDotNet/Protocol/Packets/ClientBound/DisconnectPacket.cs b/TcpDotNet/Protocol/Packets/ClientBound/DisconnectPacket.cs
index 9f365c1..ad680c8 100644
--- a/TcpDotNet/Protocol/Packets/ClientBound/DisconnectPacket.cs
+++ b/TcpDotNet/Protocol/Packets/ClientBound/DisconnectPacket.cs
@@ -1,4 +1,4 @@
-namespace TcpDotNet.Protocol.Packets.ClientBound;
+namespace TcpDotNet.Protocol.Packets.ClientBound;
[Packet(0x7FFFFFFF)]
internal sealed class DisconnectPacket : Packet
diff --git a/TcpDotNet/Protocol/Packets/ClientBound/EncryptionRequestPacket.cs b/TcpDotNet/Protocol/Packets/ClientBound/EncryptionRequestPacket.cs
index c3960f5..cbbef56 100644
--- a/TcpDotNet/Protocol/Packets/ClientBound/EncryptionRequestPacket.cs
+++ b/TcpDotNet/Protocol/Packets/ClientBound/EncryptionRequestPacket.cs
@@ -1,4 +1,4 @@
-using System.Security.Cryptography;
+using System.Security.Cryptography;
namespace TcpDotNet.Protocol.Packets.ClientBound;
diff --git a/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs b/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs
index 8fcf1a8..2e3ecd2 100644
--- a/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs
+++ b/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs
@@ -1,4 +1,4 @@
-using TcpDotNet.Protocol.Packets.ServerBound;
+using TcpDotNet.Protocol.Packets.ServerBound;
namespace TcpDotNet.Protocol.Packets.ClientBound;
diff --git a/TcpDotNet/Protocol/Packets/ClientBound/PongPacket.cs b/TcpDotNet/Protocol/Packets/ClientBound/PongPacket.cs
index 7952016..7bc7a60 100644
--- a/TcpDotNet/Protocol/Packets/ClientBound/PongPacket.cs
+++ b/TcpDotNet/Protocol/Packets/ClientBound/PongPacket.cs
@@ -1,4 +1,4 @@
-namespace TcpDotNet.Protocol.Packets.ClientBound;
+namespace TcpDotNet.Protocol.Packets.ClientBound;
///
/// Represents a packet which performs a heartbeat response.
diff --git a/TcpDotNet/Protocol/Packets/ClientBound/SessionExchangePacket.cs b/TcpDotNet/Protocol/Packets/ClientBound/SessionExchangePacket.cs
index e7679ac..3301b50 100644
--- a/TcpDotNet/Protocol/Packets/ClientBound/SessionExchangePacket.cs
+++ b/TcpDotNet/Protocol/Packets/ClientBound/SessionExchangePacket.cs
@@ -1,4 +1,4 @@
-namespace TcpDotNet.Protocol.Packets.ClientBound;
+namespace TcpDotNet.Protocol.Packets.ClientBound;
[Packet(0x7FFFFFE4)]
internal sealed class SessionExchangePacket : Packet
diff --git a/TcpDotNet/Protocol/Packets/ServerBound/EncryptionResponsePacket.cs b/TcpDotNet/Protocol/Packets/ServerBound/EncryptionResponsePacket.cs
index 935cca6..4107174 100644
--- a/TcpDotNet/Protocol/Packets/ServerBound/EncryptionResponsePacket.cs
+++ b/TcpDotNet/Protocol/Packets/ServerBound/EncryptionResponsePacket.cs
@@ -1,4 +1,4 @@
-using TcpDotNet.Protocol.Packets.ClientBound;
+using TcpDotNet.Protocol.Packets.ClientBound;
namespace TcpDotNet.Protocol.Packets.ServerBound;
diff --git a/TcpDotNet/Protocol/Packets/ServerBound/HandshakeRequestPacket.cs b/TcpDotNet/Protocol/Packets/ServerBound/HandshakeRequestPacket.cs
index 82e4ef3..3ac8b30 100644
--- a/TcpDotNet/Protocol/Packets/ServerBound/HandshakeRequestPacket.cs
+++ b/TcpDotNet/Protocol/Packets/ServerBound/HandshakeRequestPacket.cs
@@ -1,4 +1,4 @@
-namespace TcpDotNet.Protocol.Packets.ServerBound;
+namespace TcpDotNet.Protocol.Packets.ServerBound;
///
/// Represents a packet which requests a handshake with a .
diff --git a/TcpDotNet/Protocol/Packets/ServerBound/PingPacket.cs b/TcpDotNet/Protocol/Packets/ServerBound/PingPacket.cs
index 06eb33c..1ce5e8e 100644
--- a/TcpDotNet/Protocol/Packets/ServerBound/PingPacket.cs
+++ b/TcpDotNet/Protocol/Packets/ServerBound/PingPacket.cs
@@ -1,4 +1,4 @@
-using System.Security.Cryptography;
+using System.Security.Cryptography;
namespace TcpDotNet.Protocol.Packets.ServerBound;
diff --git a/TcpDotNet/Protocol/ProtocolReader.cs b/TcpDotNet/Protocol/ProtocolReader.cs
index 36df3bb..e9b5e53 100644
--- a/TcpDotNet/Protocol/ProtocolReader.cs
+++ b/TcpDotNet/Protocol/ProtocolReader.cs
@@ -1,4 +1,4 @@
-using System.Net;
+using System.Net;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
diff --git a/TcpDotNet/Protocol/ProtocolWriter.cs b/TcpDotNet/Protocol/ProtocolWriter.cs
index f667a30..920b867 100644
--- a/TcpDotNet/Protocol/ProtocolWriter.cs
+++ b/TcpDotNet/Protocol/ProtocolWriter.cs
@@ -1,4 +1,4 @@
-using System.Net;
+using System.Net;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
diff --git a/TcpDotNet/Protocol/RequestPacket.cs b/TcpDotNet/Protocol/RequestPacket.cs
index 42f3bcf..f1ebe51 100644
--- a/TcpDotNet/Protocol/RequestPacket.cs
+++ b/TcpDotNet/Protocol/RequestPacket.cs
@@ -1,4 +1,4 @@
-namespace TcpDotNet.Protocol;
+namespace TcpDotNet.Protocol;
///
/// Represents a request packet, which forms a request/response packet pair.
diff --git a/TcpDotNet/Protocol/ResponsePacket.cs b/TcpDotNet/Protocol/ResponsePacket.cs
index 7aade8b..87a4f8c 100644
--- a/TcpDotNet/Protocol/ResponsePacket.cs
+++ b/TcpDotNet/Protocol/ResponsePacket.cs
@@ -1,4 +1,4 @@
-namespace TcpDotNet.Protocol;
+namespace TcpDotNet.Protocol;
///
/// Represents a response packet, which forms a request/response packet pair.
diff --git a/TcpDotNet/ProtocolClient.cs b/TcpDotNet/ProtocolClient.cs
index e510ca3..f9a464f 100644
--- a/TcpDotNet/ProtocolClient.cs
+++ b/TcpDotNet/ProtocolClient.cs
@@ -1,4 +1,4 @@
-using System.Net;
+using System.Net;
using System.Net.Sockets;
using System.Security.Cryptography;
using TcpDotNet.EventData;
diff --git a/TcpDotNet/ProtocolListener.cs b/TcpDotNet/ProtocolListener.cs
index 335d313..4787449 100644
--- a/TcpDotNet/ProtocolListener.cs
+++ b/TcpDotNet/ProtocolListener.cs
@@ -1,4 +1,4 @@
-using System.Net;
+using System.Net;
using System.Net.Sockets;
using System.Security.Cryptography;
using TcpDotNet.EventData;
From 5b96ef20986f8ef087c58b91f30b6efa9984b2d2 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:45:33 +0000
Subject: [PATCH 07/25] ci: use .NET 8 SDK
---
.github/workflows/dotnet.yml | 4 ++--
.github/workflows/nightly.yml | 4 ++--
.github/workflows/prerelease.yml | 4 ++--
.github/workflows/release.yml | 4 ++--
global.json | 7 +++++++
5 files changed, 15 insertions(+), 8 deletions(-)
create mode 100644 global.json
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 41cf44d..57096f3 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -16,9 +16,9 @@ jobs:
uses: actions/checkout@v3
- name: Setup .NET
- uses: actions/setup-dotnet@v2
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: 7.0.x
+ dotnet-version: 8.0.x
- name: Add NuGet source
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index ca5ca69..266e2b4 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -15,9 +15,9 @@ jobs:
uses: actions/checkout@v3
- name: Setup .NET
- uses: actions/setup-dotnet@v2
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: 7.0.x
+ dotnet-version: 8.0.x
- name: Add GitHub NuGet source
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml
index 7f089d9..06245fd 100644
--- a/.github/workflows/prerelease.yml
+++ b/.github/workflows/prerelease.yml
@@ -15,9 +15,9 @@ jobs:
uses: actions/checkout@v3
- name: Setup .NET
- uses: actions/setup-dotnet@v2
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: 7.0.x
+ dotnet-version: 8.0.x
- name: Add GitHub NuGet source
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index b234990..910cb8d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -15,9 +15,9 @@ jobs:
uses: actions/checkout@v3
- name: Setup .NET
- uses: actions/setup-dotnet@v2
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: 7.0.x
+ dotnet-version: 8.0.x
- name: Add GitHub NuGet source
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
diff --git a/global.json b/global.json
new file mode 100644
index 0000000..b5b37b6
--- /dev/null
+++ b/global.json
@@ -0,0 +1,7 @@
+{
+ "sdk": {
+ "version": "8.0.0",
+ "rollForward": "latestMajor",
+ "allowPrerelease": false
+ }
+}
\ No newline at end of file
From 86ef24478900b2faeca6c83c75de98415378fa83 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:45:48 +0000
Subject: [PATCH 08/25] chore: add workflows and solution items to sln
---
TcpDotNet.sln | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/TcpDotNet.sln b/TcpDotNet.sln
index 1a518a6..655709f 100644
--- a/TcpDotNet.sln
+++ b/TcpDotNet.sln
@@ -6,6 +6,21 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TcpDotNet.ListenerIntegrati
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TcpDotNet.ClientIntegrationTest", "TcpDotNet.ClientIntegrationTest\TcpDotNet.ClientIntegrationTest.csproj", "{ED9C812F-9835-4268-9AFC-57CFAAC16162}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D55FB87A-1066-489D-B0CC-F2C09B611751}"
+ ProjectSection(SolutionItems) = preProject
+ .gitignore = .gitignore
+ LICENSE.md = LICENSE.md
+ README.md = README.md
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{0FAB77D5-AAE4-4722-A5F4-88A239858D65}"
+ ProjectSection(SolutionItems) = preProject
+ .github\workflows\dotnet.yml = .github\workflows\dotnet.yml
+ .github\workflows\nightly.yml = .github\workflows\nightly.yml
+ .github\workflows\prerelease.yml = .github\workflows\prerelease.yml
+ .github\workflows\release.yml = .github\workflows\release.yml
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
From 6959778e09a2b71ba10324a2846998bf93b99cb4 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:46:37 +0000
Subject: [PATCH 09/25] ci: run dotnet on all branches
---
.github/workflows/dotnet.yml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 57096f3..ae53f18 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -2,9 +2,13 @@ name: .NET
on:
push:
- branches: [ main, develop ]
+ branches:
+ - '*'
+ - '*/*'
pull_request:
- branches: [ main, develop ]
+ branches:
+ - '*'
+ - '*/*'
jobs:
build:
From 7b21514dc43352af96ce5fa210e42f7150e11588 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:46:58 +0000
Subject: [PATCH 10/25] ci: run nightly on push to main, or workflow_dispatch
---
.github/workflows/nightly.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index 266e2b4..913a55b 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -3,7 +3,8 @@ name: Publish Nightly
on:
push:
branches:
- - develop
+ - main
+ workflow_dispatch:
jobs:
nightly:
From 65cb143b0648810953ab6582395bf0a43adb648f Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:48:40 +0000
Subject: [PATCH 11/25] [ci skip] style(docs): use flat-square shield style
---
README.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index c08825b..264e42d 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
TcpDotNet
-
-
-
-
-
-
+
+
+
+
+
+
### About
From ff78acfb56e039ec9d7f2635ee2261a101e40024 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:58:38 +0000
Subject: [PATCH 12/25] fix: HandshakeRequestPacket inherits RequestPacket
---
.../Protocol/Packets/ServerBound/HandshakeRequestPacket.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/TcpDotNet/Protocol/Packets/ServerBound/HandshakeRequestPacket.cs b/TcpDotNet/Protocol/Packets/ServerBound/HandshakeRequestPacket.cs
index 3ac8b30..afe4102 100644
--- a/TcpDotNet/Protocol/Packets/ServerBound/HandshakeRequestPacket.cs
+++ b/TcpDotNet/Protocol/Packets/ServerBound/HandshakeRequestPacket.cs
@@ -4,7 +4,7 @@ namespace TcpDotNet.Protocol.Packets.ServerBound;
/// Represents a packet which requests a handshake with a .
///
[Packet(0x7FFFFFE0)]
-internal sealed class HandshakeRequestPacket : Packet
+internal sealed class HandshakeRequestPacket : RequestPacket
{
///
/// Initializes a new instance of the class.
From 18b0ff3f251e3a454d96dfdd47841f75cce2d598 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 17:59:54 +0000
Subject: [PATCH 13/25] perf: use static RandomNumberGenerator to generate AES
key
---
TcpDotNet/ProtocolClient.cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/TcpDotNet/ProtocolClient.cs b/TcpDotNet/ProtocolClient.cs
index f9a464f..f16829e 100644
--- a/TcpDotNet/ProtocolClient.cs
+++ b/TcpDotNet/ProtocolClient.cs
@@ -113,8 +113,7 @@ public sealed class ProtocolClient : ClientNode
byte[] encryptedPayload = rsa.Encrypt(encryptionRequest.Payload, true);
var key = new byte[128];
- using var rng = new RNGCryptoServiceProvider();
- rng.GetBytes(key);
+ RandomNumberGenerator.Fill(key);
Aes = CryptographyUtils.GenerateAes(key);
byte[] aesKey = rsa.Encrypt(key, true);
From a3e540ac83026a382aca865bf4d3284f22458c02 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 18:03:46 +0000
Subject: [PATCH 14/25] refactor: generate callback ID from RequestPacket, not
client
---
TcpDotNet/ClientNode.cs | 26 ++++++++++++--------------
TcpDotNet/Protocol/RequestPacket.cs | 15 ++++++++++++++-
2 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/TcpDotNet/ClientNode.cs b/TcpDotNet/ClientNode.cs
index 6ff6b55..7a931b4 100644
--- a/TcpDotNet/ClientNode.cs
+++ b/TcpDotNet/ClientNode.cs
@@ -15,7 +15,6 @@ namespace TcpDotNet;
///
public abstract class ClientNode : Node
{
- private readonly ObjectIDGenerator _callbackIdGenerator = new();
private readonly ConcurrentDictionary>> _packetCompletionSources = new();
private EndPoint? _remoteEP;
@@ -219,25 +218,27 @@ public abstract class ClientNode : Node
///
/// Sends a packet, and waits for a specific packet to be received.
///
- /// The packet to send.
- /// A cancellation token that can be used to cancel the asynchronous operation.
+ /// The packet to send.
+ ///
+ /// A cancellation token that can be used to cancel the asynchronous operation.
+ ///
/// The type of the packet to return.
/// The received packet.
///
- /// This method will consume all incoming packets, raising their associated handlers if such packets are recognised.
+ /// This method will consume all incoming packets, raising their associated handlers if such packets are
+ /// recognised.
///
- public async Task SendAndReceiveAsync(Packet packetToSend,
+ /// is .
+ public async Task SendAndReceiveAsync(RequestPacket packet,
CancellationToken cancellationToken = default)
where TReceive : Packet
{
+ if (packet is null) throw new ArgumentNullException(nameof(packet));
+
var attribute = typeof(TReceive).GetCustomAttribute();
if (attribute is null)
throw new ArgumentException($"The packet type {typeof(TReceive).Name} is not a valid packet.");
- var requestPacket = packetToSend as RequestPacket;
- if (requestPacket is not null)
- requestPacket.CallbackId = _callbackIdGenerator.GetId(packetToSend, out _);
-
var completionSource = new TaskCompletionSource();
if (!_packetCompletionSources.TryGetValue(attribute.Id,
out List>? completionSources))
@@ -252,15 +253,12 @@ public abstract class ClientNode : Node
completionSources.Add(completionSource);
}
- await SendPacketAsync(packetToSend, cancellationToken);
+ await SendPacketAsync(packet, cancellationToken);
TReceive response;
do
{
response = await WaitForPacketAsync(completionSource, cancellationToken);
- if (requestPacket is null)
- break;
-
- if (response is ResponsePacket responsePacket && responsePacket.CallbackId == requestPacket.CallbackId)
+ if (response is ResponsePacket responsePacket && responsePacket.CallbackId == packet.CallbackId)
break;
} while (true);
diff --git a/TcpDotNet/Protocol/RequestPacket.cs b/TcpDotNet/Protocol/RequestPacket.cs
index f1ebe51..21037d9 100644
--- a/TcpDotNet/Protocol/RequestPacket.cs
+++ b/TcpDotNet/Protocol/RequestPacket.cs
@@ -1,3 +1,6 @@
+using System.Buffers.Binary;
+using System.Security.Cryptography;
+
namespace TcpDotNet.Protocol;
///
@@ -5,11 +8,21 @@ namespace TcpDotNet.Protocol;
///
public abstract class RequestPacket : Packet
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ protected RequestPacket()
+ {
+ Span buffer = stackalloc byte[8];
+ RandomNumberGenerator.Fill(buffer);
+ CallbackId = BinaryPrimitives.ReadInt64BigEndian(buffer);
+ }
+
///
/// Gets the request identifier.
///
/// The request identifier.
- public long CallbackId { get; internal set; }
+ public long CallbackId { get; private set; }
///
protected internal override void Deserialize(ProtocolReader reader)
From 4f846180aa8b3accc34a66ce886069ed74c1430f Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 18:06:46 +0000
Subject: [PATCH 15/25] [ci skip] chore: add ko_fi funding link to repo
---
.github/FUNDING.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 835b96d..86dc0fe 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1 +1,2 @@
+ko_fi: oliverbooth
custom: ['https://buymeacoffee.com/oliverbooth']
From 94f8886a64eebdf018af9a23dfdff1335c0eb5b8 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 18:10:02 +0000
Subject: [PATCH 16/25] chore!: remove netstandard2.1 target
---
README.md | 2 +-
TcpDotNet/TcpDotNet.csproj | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 264e42d..339255f 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
### About
-TcpDotNet is a .NET Standard 2.1 package that enables you to perform server/client communications over the TCP protocol.
+TcpDotNet is a .NET package that enables you to perform server/client communications over the TCP protocol.
This package is a work-in-progress and not deemed ready for production use. However, it is available on NuGet as a very crude and early development build. This package will be maintained as I see fit.
*(I'm also [dogfooding](https://www.pcmag.com/encyclopedia/term/dogfooding) this library, so there's that.)*
diff --git a/TcpDotNet/TcpDotNet.csproj b/TcpDotNet/TcpDotNet.csproj
index aa54b53..13471c9 100644
--- a/TcpDotNet/TcpDotNet.csproj
+++ b/TcpDotNet/TcpDotNet.csproj
@@ -1,7 +1,7 @@
- netstandard2.1;net6.0;net7.0;net8.0
+ net6.0;net7.0;net8.0
enable
enable
10
From 3aebd26460a5a735f11284dbc05b9d413dd0b4c9 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 19:13:22 +0000
Subject: [PATCH 17/25] [ci skip] docs: bump version in readme to 1.0.0
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 339255f..da8bb22 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ This package is a work-in-progress and not deemed ready for production use. Howe
## Installation
### NuGet installation
```ps
-Install-Package TcpDotNet -Version 0.1.0-nightly.1
+Install-Package TcpDotNet -Version 1.0.0
```
### Manual installation
From 0a9348fd66fb675e6870e10327df5409ed1c1833 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 19:24:58 +0000
Subject: [PATCH 18/25] feat: add parameterless ctor for reflection
---
TcpDotNet/Protocol/ResponsePacket.cs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/TcpDotNet/Protocol/ResponsePacket.cs b/TcpDotNet/Protocol/ResponsePacket.cs
index 87a4f8c..f162c92 100644
--- a/TcpDotNet/Protocol/ResponsePacket.cs
+++ b/TcpDotNet/Protocol/ResponsePacket.cs
@@ -14,6 +14,10 @@ public abstract class ResponsePacket : Packet
CallbackId = callbackId;
}
+ internal ResponsePacket()
+ {
+ }
+
///
/// Gets the response identifier.
///
From 362c51cd095d61e3d9c25bcb67d4088cca54e1fc Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 19:26:33 +0000
Subject: [PATCH 19/25] refactor!: use completion source for expected response
This commit changes the constraint on TReceive making it a breaking change!
---
TcpDotNet/ClientNode.cs | 40 ++++---------------
.../ClientBound/HandshakeResponsePacket.cs | 6 ++-
2 files changed, 12 insertions(+), 34 deletions(-)
diff --git a/TcpDotNet/ClientNode.cs b/TcpDotNet/ClientNode.cs
index 7a931b4..bc8ebd9 100644
--- a/TcpDotNet/ClientNode.cs
+++ b/TcpDotNet/ClientNode.cs
@@ -2,7 +2,6 @@ using System.Collections.Concurrent;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
-using System.Runtime.Serialization;
using Chilkat;
using TcpDotNet.Protocol;
using Stream = System.IO.Stream;
@@ -16,6 +15,7 @@ namespace TcpDotNet;
public abstract class ClientNode : Node
{
private readonly ConcurrentDictionary>> _packetCompletionSources = new();
+ private readonly ConcurrentDictionary> _callbackCompletionSources = new();
private EndPoint? _remoteEP;
///
@@ -231,38 +231,16 @@ public abstract class ClientNode : Node
/// is .
public async Task SendAndReceiveAsync(RequestPacket packet,
CancellationToken cancellationToken = default)
- where TReceive : Packet
+ where TReceive : ResponsePacket
{
if (packet is null) throw new ArgumentNullException(nameof(packet));
- var attribute = typeof(TReceive).GetCustomAttribute();
- if (attribute is null)
- throw new ArgumentException($"The packet type {typeof(TReceive).Name} is not a valid packet.");
-
- var completionSource = new TaskCompletionSource();
- if (!_packetCompletionSources.TryGetValue(attribute.Id,
- out List>? completionSources))
- {
- completionSources = new List>();
- _packetCompletionSources.TryAdd(attribute.Id, completionSources);
- }
-
- lock (completionSources)
- {
- if (!completionSources.Contains(completionSource))
- completionSources.Add(completionSource);
- }
+ var completionSource = new TaskCompletionSource();
+ if (!_callbackCompletionSources.TryAdd(packet.CallbackId, completionSource))
+ throw new InvalidOperationException("Duplicate packet sent");
await SendPacketAsync(packet, cancellationToken);
- TReceive response;
- do
- {
- response = await WaitForPacketAsync(completionSource, cancellationToken);
- if (response is ResponsePacket responsePacket && responsePacket.CallbackId == packet.CallbackId)
- break;
- } while (true);
-
- return response;
+ return (TReceive)await completionSource.Task;
}
///
@@ -281,10 +259,8 @@ public abstract class ClientNode : Node
return WaitForPacketAsync(completionSource, cancellationToken);
}
- private async Task WaitForPacketAsync(
- TaskCompletionSource completionSource,
- CancellationToken cancellationToken = default
- )
+ private async Task WaitForPacketAsync(TaskCompletionSource completionSource,
+ CancellationToken cancellationToken = default)
where TPacket : Packet
{
var attribute = typeof(TPacket).GetCustomAttribute();
diff --git a/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs b/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs
index 2e3ecd2..b0eb8e2 100644
--- a/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs
+++ b/TcpDotNet/Protocol/Packets/ClientBound/HandshakeResponsePacket.cs
@@ -6,14 +6,16 @@ namespace TcpDotNet.Protocol.Packets.ClientBound;
/// Represents a packet which responds to a .
///
[Packet(0x7FFFFFE1)]
-internal sealed class HandshakeResponsePacket : Packet
+internal sealed class HandshakeResponsePacket : ResponsePacket
{
///
/// Initializes a new instance of the class.
///
+ /// The callback ID.
/// The requested protocol version.
/// The handshake response.
- public HandshakeResponsePacket(int protocolVersion, HandshakeResponse handshakeResponse)
+ public HandshakeResponsePacket(long callbackId, int protocolVersion, HandshakeResponse handshakeResponse)
+ : base(callbackId)
{
ProtocolVersion = protocolVersion;
HandshakeResponse = handshakeResponse;
From bb734eac96ef5603fb6cebc87a60d5feaa89f3cf Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 19:26:49 +0000
Subject: [PATCH 20/25] feat: pass cancellation token to ConnectAsync
---
TcpDotNet/ProtocolClient.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/TcpDotNet/ProtocolClient.cs b/TcpDotNet/ProtocolClient.cs
index f16829e..550368e 100644
--- a/TcpDotNet/ProtocolClient.cs
+++ b/TcpDotNet/ProtocolClient.cs
@@ -82,7 +82,7 @@ public sealed class ProtocolClient : ClientNode
BaseSocket = new Socket(remoteEP.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
try
{
- await Task.Run(() => BaseSocket.ConnectAsync(remoteEP), cancellationToken);
+ await Task.Run(() => BaseSocket.ConnectAsync(remoteEP, cancellationToken), cancellationToken);
}
catch
{
From 56de55ca40490cb0d177b1e9c0ac9330b990f39b Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 19:28:38 +0000
Subject: [PATCH 21/25] fix: pass callback id to handshake response ctor
---
.../PacketHandlers/HandshakeRequestPacketHandler.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs b/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
index 78a1861..217f411 100644
--- a/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
+++ b/TcpDotNet/Protocol/PacketHandlers/HandshakeRequestPacketHandler.cs
@@ -22,14 +22,14 @@ internal sealed class HandshakeRequestPacketHandler : PacketHandler
Date: Mon, 12 Feb 2024 22:48:00 +0000
Subject: [PATCH 22/25] style: add branding graphics
---
README.md | 2 +-
TcpDotNet.sln | 2 ++
TcpDotNet/TcpDotNet.csproj | 9 +++++++++
branding_Banner.png | Bin 0 -> 20139 bytes
branding_Icon.png | Bin 0 -> 7054 bytes
5 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 branding_Banner.png
create mode 100644 branding_Icon.png
diff --git a/README.md b/README.md
index da8bb22..5a5c582 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-TcpDotNet
+
diff --git a/TcpDotNet.sln b/TcpDotNet.sln
index 655709f..dd1fca7 100644
--- a/TcpDotNet.sln
+++ b/TcpDotNet.sln
@@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitignore = .gitignore
LICENSE.md = LICENSE.md
README.md = README.md
+ branding_Banner.png = branding_Banner.png
+ branding_Icon.png = branding_Icon.png
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{0FAB77D5-AAE4-4722-A5F4-88A239858D65}"
diff --git a/TcpDotNet/TcpDotNet.csproj b/TcpDotNet/TcpDotNet.csproj
index 13471c9..515cbd5 100644
--- a/TcpDotNet/TcpDotNet.csproj
+++ b/TcpDotNet/TcpDotNet.csproj
@@ -12,6 +12,7 @@
git
A TCP library for .NET with support for AES encryption.
LICENSE.md
+ branding_Icon.png
dotnet networking encryption tcp
0.1.0
true
@@ -40,10 +41,18 @@
+
+ True
+
+
True
+
+ True
+
+
diff --git a/branding_Banner.png b/branding_Banner.png
new file mode 100644
index 0000000000000000000000000000000000000000..50ae366d7296c4670b2a20c04a947ac612c715b3
GIT binary patch
literal 20139
zcmeIa_ghol5;hz_K(Sz4acK0YOEIQi7-`1QJ>j
zdO)Q}3n&mELXZ|9gh&k~B;VfgJmqlL5`0CzP8-GbR!S~*}5D2!}nt_iVcCtLyRw+y&jq|
zGw2uZFpg09V;TRls#V);=HoZY-fP{_#zXx_2`c9fzfadxQQT>U&3B4#ZZC|FzkGS^
z;7&_i4{lHBRl939Z;t0aKbedf*n5BNpqb(cai_BSRvpjL3%~lz$ain(_*WOWHk_(i
z+pga+caz(mp{C}ZwHoxDUx3H32|X@FO%}l`H!979xcD
z&kY1}*xh6s
z-*t?UKCt)rn!WT7Uib(*C$4wZd~}wk8g)a~z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sP3d$>aX8@Tktdan=`65$@dFKaAi
zj=9ymHgZ9$OCNf9*k{j?n{N3cx(yB}qGeiZMMt5Ed;FE`K*t|-c+!lW@vroQCo=*u
zloMFh3HMx$A@<+^64oovQpL|nFZPOpILw3fB_-&f|&(uiYD7!Nrn|@Z2Qs(diN$h|N&pkhe|PVZyKiA+!9KOD*LB112s5Wo&M+E%iy~zF{7r7tSK|#5PgW_vsOgc2S?4R0mWODFlib|m0
zXvJg=fGjf)0c3$d@UP@8whSM+^wOE#Jsw6UJD7?^@;leivOn*ADqcYkKsqUqR6x87%piS6Q%J}T
zg?euIFXZnAjWQts(=&L&Z!;}LYng5KkyFV8_5F3<^fx-!&EfLK@D?sG0sB7_Eah`&
zz7nxDD-`+Hg~E{B>i-#rteB&^M=k#LVqJ-v0}E(1B)2{h`Mw@<^mPw6F^co>lgf*4
z=rer4>DV-d|Eyy>zndG!9XoWoUywcF%EIa|4X>MVv&26uLLgV5z~bUkne0Dgj3%)5
zEq|XGf5Y6EZc9|S1Pk76@PI?*Ha3x@HP$%EJ5;_MoSreKgW;Ygy
zHJExp(Y|it#yYovGg-rQ+Gs#+%uV@4E>91lVKvNz9xp7hW^D<%LG2*VXV(3Uu_nuH
zOirJdE8ke8?qUB;z-J(mCi6Wo_8{t)^ynzTkHekzBGm>j0OwbRHGk!1f^%3~k9^Wy
zJVe&NyOw^V5QW`DFLhDR;{HZDgpRSJ5`NBVIGXfxu`updpG_w_5v*F)uNtS--jc2@c(4`tH5MM>
zg6uV|Q8LIExaBrwxZ7DV!o(eyhsfp2T>#Se{FhiIML=NPToRxN@Y!078AIX)Ljk9n
zVFA!1Q*L?)03S%*sap}^_65MZD&kO~4?vQ@&+rOQ4e&O4$0hI!{QP_SuO0q%g1yk;odFSVh4b3iK&N)B${{T+pLVExJ
literal 0
HcmV?d00001
diff --git a/branding_Icon.png b/branding_Icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..781d41153d7f47832f3b1f79032108ba6219fd2d
GIT binary patch
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cs b/TcpDotNet/ProtocolClient.cs
index 550368e..b9d362c 100644
--- a/TcpDotNet/ProtocolClient.cs
+++ b/TcpDotNet/ProtocolClient.cs
@@ -82,7 +82,7 @@ public sealed class ProtocolClient : ClientNode
BaseSocket = new Socket(remoteEP.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
try
{
- await Task.Run(() => BaseSocket.ConnectAsync(remoteEP, cancellationToken), cancellationToken);
+ await BaseSocket.ConnectAsync(remoteEP, cancellationToken);
}
catch
{
From 1485578088f6f2e5d42a331b206103b8ab555680 Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 22:55:29 +0000
Subject: [PATCH 24/25] style: remove redundant line break
---
TcpDotNet/ProtocolClient.cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/TcpDotNet/ProtocolClient.cs b/TcpDotNet/ProtocolClient.cs
index b9d362c..42e9a44 100644
--- a/TcpDotNet/ProtocolClient.cs
+++ b/TcpDotNet/ProtocolClient.cs
@@ -95,8 +95,7 @@ public sealed class ProtocolClient : ClientNode
State = ClientState.Handshaking;
var handshakeRequest = new HandshakeRequestPacket(ProtocolVersion);
- var handshakeResponse =
- await SendAndReceiveAsync(handshakeRequest, cancellationToken);
+ var handshakeResponse = await SendAndReceiveAsync(handshakeRequest, cancellationToken);
if (handshakeResponse.HandshakeResponse != HandshakeResponse.Success)
{
From 45111aae721f3b593e1e9ff6214e6339e50b39fa Mon Sep 17 00:00:00 2001
From: Oliver Booth
Date: Mon, 12 Feb 2024 22:57:19 +0000
Subject: [PATCH 25/25] [ci skip] style: give exception message a variable to
remove concat
---
TcpDotNet/ProtocolClient.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/TcpDotNet/ProtocolClient.cs b/TcpDotNet/ProtocolClient.cs
index 42e9a44..de0bb89 100644
--- a/TcpDotNet/ProtocolClient.cs
+++ b/TcpDotNet/ProtocolClient.cs
@@ -101,8 +101,9 @@ public sealed class ProtocolClient : ClientNode
{
Close();
IsConnected = false;
- throw new InvalidOperationException("Handshake failed. " +
- $"Server responded with {handshakeResponse.HandshakeResponse:D}");
+
+ var message = $"Handshake failed. Server responded with {handshakeResponse.HandshakeResponse:D}";
+ throw new InvalidOperationException(message);
}
State = ClientState.Encrypting;