Refactor: libpacemaker: Default to poll dispatch in pcmk_cluster_queries
Previously, we used pcmk_ipc_dispatch_main if (message_timeout_ms != 0).
This created a mainloop, and we then sat and waited on the mainloop, so
that the request was effectively synchronous. It makes more sense to
poll for the given timeout instead; there's less overhead and it's
designed for the purpose.
More importantly, this eliminates some uncertainty about what would
happen if the caller already had a mainloop and then a function in
pcmk_cluster_queries.c created its own.
Note that we no longer call pcmk_disconnect_ipc() directly. (We used to
via event_done().) This is intentional. With pcmk_ipc_dispatch_poll,
pcmk_disconnect_ipc() frees api->ipc and sets it to NULL. If we call
pcmk_disconnect_ipc() within a callback, then we get an assertion error
when we finish dispatching that message and return to the while loop in
pcmk_dispatch_ipc() to check for more messages. crm_ipc_ready() finds
that api->ipc is NULL.
Instead, we dispatch everything in the IPC buffer and then free the API
object.
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>