]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/basic/macro.h
resolved: fix notification iteration logic when transactions are completed 2702/head
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Feb 2016 19:39:45 +0000 (20:39 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 22 Feb 2016 22:24:47 +0000 (23:24 +0100)
commit35aa04e9edf422beac3493afa555d29575b3046c
tree82daef9aac197fd20b341ea3bf255ab7bdc704ac
parent1a39bc8c650802630696c38e510a4a2a4c6bda92
resolved: fix notification iteration logic when transactions are completed

When a transaction is complete, and we notify its owners, make sure we deal
correctly with the requesters removing themselves from the list of owners while
we continue iterating.

This was previously already dealt with with transactions that require other
transactions for DNSSEC purposes, fix this for other possibly transaction
owners too now.

Since iterating through "Set" objects is not safe regarding removal of entries
from it, rework the logic to use two Sets, and move each entry we notified from
one set to the other set before we dispatch the notification. This move operation
requires no additional memory, and enables us to ensure that we don't notify
any object twice.

Fixes: #2676
src/basic/macro.h
src/basic/set.h
src/resolve/resolved-dns-query.c
src/resolve/resolved-dns-transaction.c
src/resolve/resolved-dns-transaction.h
src/resolve/resolved-dns-zone.c