Ejemplo n.º 1
0
        public Task Send(IPacketV2 <IPayload> packet, CancellationToken cancel)
        {
            Interlocked.Increment(ref _txPackets);
            var buffer = new byte[packet.GetMaxByteSize()];
            var size   = packet.Serialize(buffer, 0);

            return(DataStream.Send(buffer, size, cancel));
        }
Ejemplo n.º 2
0
        public Task Send(IPacketV2 <IPayload> packet, CancellationToken cancel)
        {
            if (_disposed != 0)
            {
                return(Task.CompletedTask);
            }
            Interlocked.Increment(ref _txPackets);
            var buffer = new byte[packet.GetMaxByteSize()];
            var size   = packet.Serialize(buffer, 0);

            _sendPacketSubject.OnNext(packet);
            return(DataStream.Send(buffer, size, cancel));
        }