chore: slight adjustments to async

This commit is contained in:
Timothy Schenk 2023-11-16 12:23:22 +01:00
parent 797ea61f36
commit 854ac06de6
2 changed files with 6 additions and 6 deletions

View file

@ -31,7 +31,7 @@ public class AuthSession : TcpSession
public void Send(IPacket packet)
{
var type = packet.GetType();
this._logger.LogTrace("Packet of type {Type} is being serialized", type.Name);
this._logger.LogInformation("Packet of type {Type} is being serialized", type.Name);
var packetIdAttribute = type.GetCustomAttribute<PacketIdAttribute>();
if (packetIdAttribute == null)
{
@ -59,8 +59,8 @@ public class AuthSession : TcpSession
buffer[2 + i] = bytesOfOpcode[i];
}
this._logger.LogTrace("Packet data being parsed is: {Data}", BitConverter.ToString(packetData.ToArray()));
this._logger.LogTrace("Packet being parsed is: {Data}", BitConverter.ToString(buffer.ToArray()));
this._logger.LogInformation("Packet data being parsed is: {Data}", BitConverter.ToString(packetData.ToArray()));
this._logger.LogInformation("Packet being parsed is: {Data}", BitConverter.ToString(buffer.ToArray()));
this.Send(buffer);
}

View file

@ -59,9 +59,9 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket>
Health = 250,
Mana = 250,
});
await _wonderkingContext.SaveChangesAsync().ConfigureAwait(false);
await _wonderkingContext.SaveChangesAsync().ConfigureAwait(true);
var character = await _wonderkingContext.Characters.AsNoTracking()
var character = await _wonderkingContext.Characters.AsNoTrackingWithIdentityResolution()
.Where(c => authSession != null && c.Account.Id == authSession.AccountId && c.Name == packet.Name)
.Select(c =>
new CharacterData
@ -82,7 +82,7 @@ public class CharacterCreationHandler : IPacketHandler<CharacterCreationPacket>
.Where(item => item.InventoryTab == InventoryTab.WornCashEquipment)
.Select(item => item.ItemId)
.ToArray(),
}).FirstOrDefaultAsync().ConfigureAwait(true);
}).FirstAsync().ConfigureAwait(true);
authSession?.Send(new CharacterCreationResponsePacket { Character = character });
}
}