25 lines
786 B
C#
25 lines
786 B
C#
// Copyright (c) 2023 Timothy Schenk. Subject to the GNU AGPL Version 3 License.
|
|
|
|
using Continuity.AuthServer.Packets;
|
|
using MassTransit;
|
|
using NetCoreServer;
|
|
using Rai.PacketMediator;
|
|
using Wonderking.Packets;
|
|
|
|
namespace Continuity.AuthServer.Consumers;
|
|
|
|
public class PacketConsumer : IConsumer<RawPacket>
|
|
{
|
|
private readonly PacketDistributorService<OperationCode, TcpSession> _distributorService;
|
|
|
|
public PacketConsumer(PacketDistributorService<OperationCode, TcpSession> distributorService)
|
|
{
|
|
_distributorService = distributorService;
|
|
}
|
|
|
|
public Task Consume(ConsumeContext<RawPacket> context)
|
|
{
|
|
return _distributorService.AddPacketAsync(context.Message.MessageBody, context.Message.OperationCode,
|
|
context.Message.Session);
|
|
}
|
|
}
|