mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
cd58874a9b
Changes the behavior of the message cache to optimize for cache capacity. Previously, the message cache's primary function was to avoid decrypting messages multiple times, although the cache's main function in the spec is to avoid message rebroadcasting. Optimizing for minimal decryption causes us to fill the network cache faster, which in turn causes more cache misses, potentially outweighing the advantage. Now stores src + seq in message cache instead of field hash value. This cuts cache size in two, while including more of the sequence number than before. Adds messages to the cache only after the packet is successfully decrypted. This reduces noise in the cache, and ensures that no invalid deobfuscations are added. Additionally, this fixes a bug where multiple calls to net_decrypt with the same packet failed, as the message cache found its own entry from the previous call.