This commit is contained in:
Juhani Krekelä 2019-07-08 11:23:51 +03:00
parent 4d03f397df
commit 1f179e8b2b
1 changed files with 6 additions and 0 deletions

View File

@ -73,6 +73,12 @@ ssize_t msgid_cache_lookup(const unsigned char mac[6]) {
ssize_t msgid_cache_add(const unsigned char mac[6]) {
ssize_t index = next_slot++;
// If we are adding into a new slot (instead of overwriting one),
// expand the fill pointer
if (msgid_cache_fill < index) {
msgid_cache_fill++;
}
memcpy(msgid_cache[index].other_mac, mac, sizeof(msgid_cache[index].other_mac));
msgid_cache[index].know_send = false;
msgid_cache[index].know_receive = false;