chiark / gitweb /
resolved: fix notification iteration logic when transactions are completed
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Feb 2016 19:39:45 +0000 (20:39 +0100)
committerSven Eden <yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:12:57 +0000 (10:12 +0200)
commit3c84247622c7d6ad51e7a49907995e3e48b5f472
treec91e04a7402f333994887f4d79dd08526bfcb342
parent45e507a05750d43384bfbe90b8b22dfb5a1c5d2a
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