From: Liu Yuan <tailai.ly at taobao.com> When the corosync dies, sheep will recive a signal but currently ignores it. If corosync restarts, we have to manually kill sheep and restart it to work with corosync. By simplicity, sheep should exit when corosync dies. Other policy like handling corosync re-join would be considered later. Signed-off-by: Liu Yuan <tailai.ly at taobao.com> --- sheep/group.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/sheep/group.c b/sheep/group.c index 92f079d..34f42bc 100644 --- a/sheep/group.c +++ b/sheep/group.c @@ -14,6 +14,7 @@ #include <netdb.h> #include <arpa/inet.h> #include <sys/time.h> +#include <sys/epoll.h> #include <corosync/cpg.h> #include <corosync/cfg.h> @@ -343,6 +344,12 @@ forward: static void group_handler(int listen_fd, int events, void *data) { + if (events & EPOLLHUP) { + eprintf("Receive EPOLLHUP event. Is corosync stopped running?\n"); + log_close(); + exit(1); + } + cpg_dispatch(sys->handle, CPG_DISPATCH_ALL); } -- 1.7.5.1 |