[sheepdog] [PATCH v2 09/11] sheep: refactor send_join_request()

Liu Yuan namei.unix at gmail.com
Sat Sep 14 12:34:29 CEST 2013


Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/group.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sheep/group.c b/sheep/group.c
index 0b03150..a371073 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -757,11 +757,12 @@ main_fn bool sd_join_handler(const struct sd_node *joining,
 	return true;
 }
 
-static int send_join_request(struct sd_node *ent)
+static int send_join_request(void)
 {
-	sd_info("%s", node_to_str(&sys->this_node));
+	struct sd_node *n = &sys->this_node;
 
-	return sys->cdrv->join(ent, &sys->cinfo, sizeof(sys->cinfo));
+	sd_info("%s", node_to_str(n));
+	return sys->cdrv->join(n, &sys->cinfo, sizeof(sys->cinfo));
 }
 
 static void requeue_cluster_request(void)
@@ -834,7 +835,7 @@ main_fn int sd_reconnect_handler(void)
 	sys->cinfo.status = SD_STATUS_WAIT;
 	if (sys->cdrv->init(sys->cdrv_option) != 0)
 		return -1;
-	if (send_join_request(&sys->this_node) != 0)
+	if (send_join_request() != 0)
 		return -1;
 	requeue_cluster_request();
 	return 0;
@@ -1000,7 +1001,7 @@ int create_cluster(int port, int64_t zone, int nr_vnodes,
 	INIT_LIST_HEAD(&sys->local_req_queue);
 	INIT_LIST_HEAD(&sys->req_wait_queue);
 
-	ret = send_join_request(&sys->this_node);
+	ret = send_join_request();
 	if (ret != 0)
 		return -1;
 
-- 
1.7.9.5




More information about the sheepdog mailing list