The cmm_notify_dispatch() function processes a cluster
membership change control message and invokes the appropriate callback function.
The process uses the select or poll commands to detect messages arriving from the nhcmmd
daemon, with at least the file descriptor returned from the cmm_notify_getfd() function. When the file descriptor indicates that data must be read, the cmm_notify__dispatch() function is called, and the registered callback function is invoked from the same thread
that calls the cmm_notify_dispatch() function.
If an error occurs on this file descriptor within poll()
or if the file descriptor is no longer valid, CMM_EBADF
is returned by cmm_notify_dispatch(). Then cmm_cmc_unregister(3CMM)
must be called and the whole registration must be performed - including calling
the cmm_cmc_register(3CMM), cmm_cmc_filter(3CMM) and cmm_notify_getfd() functions.
Note that one call to cmm_notify_dispatch() can lead
to as many calls to the callback as there are pending notifications. If within
this callback, some functions are invoked concerning the state of the cluster
(for instance, to get the number of nodes), the result of the function refers
to the state of the cluster when the function was invoked. It does not refer
to the state of the cluster when the notification was generated. In the meantime,
some other modifications could have been applied to the cluster.