// // ContractPacketResponder.cs // // Copyright (c) František Boháček. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Threading; using System.Threading.Tasks; using NosSmooth.Core.Packets; using NosSmooth.Packets; using Remora.Results; namespace NosSmooth.Core.Contracts.Responders; /// /// A responder that calls Contractor update. /// public class ContractPacketResponder : IEveryPacketResponder { private readonly Contractor _contractor; /// /// Initializes a new instance of the class. /// /// The contractor. public ContractPacketResponder(Contractor contractor) { _contractor = contractor; } /// public Task Respond(PacketEventArgs packetArgs, CancellationToken ct = default) where TPacket : IPacket => _contractor.Update(packetArgs.Packet, ct); }