refactor: slight adjustments
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 24s
Build, Package and Push Images / sonarqube (push) Has been skipped
Build, Package and Push Images / sbom-scan (push) Successful in 30s
Build, Package and Push Images / container-build (push) Successful in 1m27s
Build, Package and Push Images / container-sbom-scan (push) Successful in 34s

This commit is contained in:
Timothy Schenk 2023-11-17 08:25:29 +01:00
parent 0077d380f3
commit 42c53584f7
3 changed files with 14 additions and 9 deletions

View file

@ -1,3 +1,4 @@
using System.Net.Sockets;
using Wonderking.Packets;
namespace Server;
@ -105,4 +106,9 @@ public class AuthSession : TcpSession
return buffer;
}
protected override void OnError(SocketError error)
{
_logger.LogWarning("An error has occured: {Error}", error);
}
}

View file

@ -25,10 +25,6 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
this._wonderkingContext = wonderkingContext;
}
public ChannelSelectionHandler()
{
}
public async Task HandleAsync(ChannelSelectionPacket packet, TcpSession session)
{
var authSession = (AuthSession)session;
@ -80,12 +76,16 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
{
ChannelIsFullFlag = 0,
Endpoint = "127.0.0.1",
Port = 12345,
Port = 2000,
Characters = Array.Empty<CharacterData>()
};
}
authSession.Send(responsePacket);
if (guildNameResponsePacket.GuildNames.Length > 0 &&
guildNameResponsePacket.GuildNames.Select(n => n != string.Empty).Any())
{
authSession.Send(guildNameResponsePacket);
}
}
}

View file

@ -1,3 +1,4 @@
using System.Buffers.Binary;
using Wonderking.Packets.Outgoing.Data;
namespace Wonderking.Packets.Outgoing;
@ -34,9 +35,7 @@ public class LoginResponsePacket : IPacket
dataSpan[0] = (byte)this.ResponseReason;
dataSpan[1] = this.UnknownFlag;
dataSpan[2] = BitConverter.GetBytes(this.IsGameMaster)[0];
var bytesOfChannelAmount = BitConverter.GetBytes((ushort)this.ChannelData.Length);
dataSpan[3] = bytesOfChannelAmount[0];
dataSpan[4] = bytesOfChannelAmount[1];
BinaryPrimitives.WriteUInt16LittleEndian(dataSpan.Slice(3, 2), (ushort)this.ChannelData.Length);
for (var i = 0; i < this.ChannelData.Length; i++)
{