From aa6873d46c5a239dbe498f5fbb3b0357f952d785 Mon Sep 17 00:00:00 2001 From: Evgeniy Polyakov Date: Wed, 3 Oct 2012 09:26:15 +0400 Subject: [PATCH] If state is already exist, it should not be an error --- library/dnet_common.c | 4 ++++ library/net.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/library/dnet_common.c b/library/dnet_common.c index 084b000..d7e5b1c 100644 --- a/library/dnet_common.c +++ b/library/dnet_common.c @@ -395,6 +395,10 @@ int dnet_add_state(struct dnet_node *n, struct dnet_config *cfg) return 0; err_out_reconnect: + /* if state is already exist, it should not be an error */ + if (err == -EEXIST) + err = 0; + if ((err == -EADDRINUSE) || (err == -ECONNREFUSED) || (err == -ECONNRESET) || (err == -EINPROGRESS) || (err == -EAGAIN)) dnet_add_reconnect_state(n, &addr, join); diff --git a/library/net.c b/library/net.c index 1bc87ee..ce2b741 100644 --- a/library/net.c +++ b/library/net.c @@ -1023,7 +1023,7 @@ err_out_close: err_out_exit: if (err == -EEXIST) - dnet_log(n, DNET_LOG_ERROR, "%s: state already exists.\n", dnet_server_convert_dnet_addr(addr)); + dnet_log(n, DNET_LOG_NOTICE, "%s: state already exists.\n", dnet_server_convert_dnet_addr(addr)); *errp = err; return NULL; } -- 2.11.4.GIT