private async Task DispatchIncomingPacket() { using (var bufferScope = _bufferPool.CreateScope()) { var packet = _uncompressedPacketObjectPool.Get(); try { if (_useCompression) { var compressedPacket = await CompressedPacket.DeserializeAsync(_remoteStream, null); packet = PacketCompress.Decompress(compressedPacket, bufferScope, _compressThreshold, packet); } else { packet = await UncompressedPacket.DeserializeAsync(_remoteStream, bufferScope, packet); } await DispatchIncomingPacket(packet); } finally { _uncompressedPacketObjectPool.Return(packet); } } }
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); } }