Calling event_base_loopbreak
before event_base_dispatch
has no effect. Fix this by calling event_base_loopbreak
from the event’s callback. From the documentation:
event_base_loop() will abort the loop after the next event is completed; event_base_loopbreak() is typically invoked from this event’s callback. This behavior is analogous to the “break;” statement.
This can be tested by running the following with and without this change:
0bitcoind -- -regtest -proxy=127.0.0.1:9050 -listen=1 -bind=127.0.0.1 -whitebind=127.0.0.1:0
Fixes #16376.