Low: controller: Ensure we don't ignore relevant CIB replacements
Currently, we use the R_CIB_ASKED flag to track whether the controller
recently requested a CIB replacement and is awaiting completion of the
request. We unset the flag during the request's callback and when we
start a new join round.
If the R_CIB_ASKED bit is set when we receive a CIB replacement
notification, and we're in S_FINALIZE_JOIN state, then we assume the
replacement is the one that we requested, and we ignore it.
However, perhaps the replacement didn't come from us. Perhaps we
received notification that a peer or another client replaced the CIB
before the replacement that we requested completes. Then we would
improperly ignore that notification, and we wouldn't trigger a new
election.
This commit addresses that corner case by tracking the call IDs of
in-flight requests we've made that might cause a CIB replacement
notification. We check the notification's F_CIB_CLIENTID to see whether
it came from us (the local controller). If so, then we check whether the
notification's call ID is in the hash table. If it is, then we remove it
and ignore the notification.
We remove the call ID from the table during the request's callback. It's
possible that we didn't get a CIB replace notification because no
relevant CIB sections changed. We still want to ensure that the call ID
gets removed, in case the cib_t:call_id wraps back around to 1 and so
that the table remains small.
We empty the table when we start a new join sequence and destroy it
during shutdown.
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>