private async Task DispatchIncomingPacket(Stream stream) { var compressedPacket = new CompressedPacket(); int count = await compressedPacket.DeserializeAsync(stream); if (count > 0) { await SendIncomingUncompressedPacket(_packetCompress.Decompress(compressedPacket)); } }
private async Task DispatchIncomingPacket() { using (var bufferScope = _bufferPool.CreateScope()) { UncompressedPacket packet; if (_useCompression) { var compressedPacket = await CompressedPacket.DeserializeAsync(_remoteStream, null); packet = _packetCompress.Decompress(compressedPacket, _compressThreshold); } else { packet = await UncompressedPacket.DeserializeAsync(_remoteStream, bufferScope); } await DispatchIncomingPacket(packet); } }