In rndc_recvdone(), if 'sends' was not 0, then 'recvs' was not
decremented, in which case isc_loopmgr_shutdown() was never reached,
which could cause a hang. (This has not been observed to happen, but
the code was incorrect on examination.)
REQUIRE(recvdone_handle == handle);
isc_nmhandle_detach(&recvdone_handle);
- if (atomic_load_acquire(&sends) == 0 &&
- atomic_fetch_sub_release(&recvs, 1) == 1)
+ if (atomic_fetch_sub_release(&recvs, 1) == 1 &&
+ atomic_load_acquire(&sends) == 0)
{
shuttingdown = true;
isc_task_detach(&rndc_task);