private async Task CreateFramingStream(PacketFlags packetFlags, CancellationToken cancellationToken) { this.framingStream = await FramingStream.CreateAsync(this.rawBuffer, cancellationToken); this.message.PacketFlags = packetFlags; await this.message.WriteToAsync(this.unframedBuffer, cancellationToken); }
private MessageEncodingStream(S101Message message, WriteBuffer rawBuffer, FramingStream framingStream) { this.unframedBuffer = new WriteBuffer(this.WriteUnframedAsync, Constants.MessageHeaderMaxLength); this.message = message; this.rawBuffer = rawBuffer; this.framingStream = framingStream; }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// internal static async Task <MessageEncodingStream> CreateAsync( WriteBuffer rawBuffer, S101Message message, CancellationToken cancellationToken) { message.PacketFlags = PacketFlags.FirstPacket | (message.CanHaveMultiplePackets ? PacketFlags.None : PacketFlags.LastPacket); var framingStream = await FramingStream.CreateAsync(rawBuffer, cancellationToken); var result = new MessageEncodingStream(message, rawBuffer, framingStream); await message.WriteToAsync(result.unframedBuffer, cancellationToken); return(result); }
private async Task CreateFramingStream(PacketFlags packetFlags, CancellationToken cancellationToken) { this.framingStream = await FramingStream.CreateAsync(this.rawBuffer, cancellationToken); this.message.PacketFlags = packetFlags; await this.message.WriteToAsync(this.unframedBuffer, cancellationToken); }
private MessageEncodingStream(S101Message message, WriteBuffer rawBuffer, FramingStream framingStream) { this.unframedBuffer = new WriteBuffer(this.WriteUnframedAsync, Constants.MessageHeaderMaxLength); this.message = message; this.rawBuffer = rawBuffer; this.framingStream = framingStream; }