chore: pre-commit test commit
This commit is contained in:
parent
659e75d2df
commit
a6b804dfe7
1 changed files with 11 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
namespace Server;
|
namespace Server;
|
||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using MassTransit.Mediator;
|
using MassTransit.Mediator;
|
||||||
|
@ -43,7 +43,7 @@ public class AuthSession : TcpSession
|
||||||
|
|
||||||
Span<byte> buffer = stackalloc byte[length];
|
Span<byte> buffer = stackalloc byte[length];
|
||||||
buffer.Clear();
|
buffer.Clear();
|
||||||
packetData.CopyTo(buffer.Slice(8, length - 8));
|
packetData.CopyTo(buffer[8..length]);
|
||||||
|
|
||||||
var bytesOfLength = BitConverter.GetBytes(length);
|
var bytesOfLength = BitConverter.GetBytes(length);
|
||||||
var bytesOfOpcode = BitConverter.GetBytes((ushort)opcode);
|
var bytesOfOpcode = BitConverter.GetBytes((ushort)opcode);
|
||||||
|
@ -71,11 +71,15 @@ public class AuthSession : TcpSession
|
||||||
// xor every value after the first 8 bytes
|
// xor every value after the first 8 bytes
|
||||||
var dataBuffer = Decrypt(new ArraySegment<byte>(buffer, 8, (int)size - 8).ToArray());
|
var dataBuffer = Decrypt(new ArraySegment<byte>(buffer, 8, (int)size - 8).ToArray());
|
||||||
|
|
||||||
this.logger.LogDebug("Length {length}", BitConverter.ToUInt16(buffer, 0));
|
this.logger.LogDebug("Length {Length}", BitConverter.ToUInt16(buffer, 0));
|
||||||
|
|
||||||
var opCode = BitConverter.ToUInt16(buffer.ToArray(), 2);
|
var opCode = BitConverter.ToUInt16(buffer.ToArray(), 2);
|
||||||
|
|
||||||
this.logger.LogDebug("Packet Op Code: {OpCode}", opCode);
|
this.logger.LogDebug("Packet Op Code: {OpCode}", opCode);
|
||||||
this.logger.LogDebug("Some Value: {RandomValue}", buffer[4]);
|
this.logger.LogDebug("Some Value: {RandomValue}", buffer[4]);
|
||||||
|
|
||||||
var clientAliveTime = BitConverter.ToUInt16(buffer.ToArray(), 5);
|
var clientAliveTime = BitConverter.ToUInt16(buffer.ToArray(), 5);
|
||||||
|
|
||||||
this.logger.LogDebug("Client Alive time: {ClientAliveTime}", clientAliveTime);
|
this.logger.LogDebug("Client Alive time: {ClientAliveTime}", clientAliveTime);
|
||||||
this.logger.LogDebug("Might be a flag: {Flag}", buffer[7]);
|
this.logger.LogDebug("Might be a flag: {Flag}", buffer[7]);
|
||||||
|
|
||||||
|
@ -83,7 +87,10 @@ public class AuthSession : TcpSession
|
||||||
|
|
||||||
var rawPacket = new RawPacket((OperationCode)opCode, dataBuffer, clientAliveTime, buffer[7],
|
var rawPacket = new RawPacket((OperationCode)opCode, dataBuffer, clientAliveTime, buffer[7],
|
||||||
buffer[4], this.Id, this);
|
buffer[4], this.Id, this);
|
||||||
Task.Run(() => this.mediator.Send(rawPacket));
|
|
||||||
|
var thread = new Thread(() => this.mediator.Send(rawPacket).Start()) { IsBackground = true };
|
||||||
|
thread.Start();
|
||||||
|
|
||||||
this.logger.LogInformation("Connection from: {@RemoteEndpoint}", this.Socket.RemoteEndPoint?.ToString());
|
this.logger.LogInformation("Connection from: {@RemoteEndpoint}", this.Socket.RemoteEndPoint?.ToString());
|
||||||
base.OnReceived(decryptedBuffer.ToArray(), offset, decryptedBuffer.Length);
|
base.OnReceived(decryptedBuffer.ToArray(), offset, decryptedBuffer.Length);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue