Просмотр исходного кода

add assert around gmi_mcast since it can return a failure now.

(Logical change 1.82)


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@292 fd59a12c-fef9-0310-b244-a6a79926bd2f
Mark Haverkamp 21 лет назад
Родитель
Сommit
46d6f3ff47
3 измененных файлов с 30 добавлено и 37 удалено
  1. 8 12
      exec/amf.c
  2. 18 21
      exec/ckpt.c
  3. 4 4
      exec/evs.c

+ 8 - 12
exec/amf.c

@@ -491,7 +491,7 @@ void componentUnregister (
 	iovecs[0].iov_base = (char *)&req_exec_amf_componentunregister;
 	iovecs[0].iov_len = sizeof (req_exec_amf_componentunregister);
 
-	gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 }
 
 #ifdef COMPILE_OUT
@@ -715,7 +715,7 @@ void haStateSetCluster (
 	iovecs[0].iov_base = (char *)&req_exec_amf_hastateset;
 	iovecs[0].iov_len = sizeof (req_exec_amf_hastateset);
 
-	gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_HIGH);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_HIGH) == 0);
 }
 
 void readinessStateSetApi (struct saAmfComponent *component,
@@ -806,7 +806,7 @@ void readinessStateSetCluster (
 	iovecs[0].iov_base = (char *)&req_exec_amf_readinessstateset;
 	iovecs[0].iov_len = sizeof (req_exec_amf_readinessstateset);
 
-	gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_HIGH);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_HIGH) == 0);
 }
 
 #ifdef CMOPILE_OUT
@@ -1330,7 +1330,7 @@ void errorReport (
 	iovecs[0].iov_base = (char *)&req_exec_amf_errorreport;
 	iovecs[0].iov_len = sizeof (req_exec_amf_errorreport);
 
-	gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 }
 
 int healthcheck_instance = 0;
@@ -2017,7 +2017,6 @@ static int message_handler_req_amf_componentregister (struct conn_info *conn_inf
 	struct req_amf_componentregister *req_lib_amf_componentregister = (struct req_amf_componentregister *)message;
 	struct req_exec_amf_componentregister req_exec_amf_componentregister;
 	struct iovec iovecs[2];
-	int result;
 
 	req_exec_amf_componentregister.header.size = sizeof (struct req_exec_amf_componentregister);
 	req_exec_amf_componentregister.header.id = MESSAGE_REQ_EXEC_AMF_COMPONENTREGISTER;
@@ -2031,7 +2030,7 @@ static int message_handler_req_amf_componentregister (struct conn_info *conn_inf
 	iovecs[0].iov_base = (char *)&req_exec_amf_componentregister;
 	iovecs[0].iov_len = sizeof (req_exec_amf_componentregister);
 
-	result = gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 
 	return (0);
 }
@@ -2041,7 +2040,6 @@ static int message_handler_req_amf_componentunregister (struct conn_info *conn_i
 	struct req_lib_amf_componentunregister *req_lib_amf_componentunregister = (struct req_lib_amf_componentunregister *)message;
 	struct req_exec_amf_componentunregister req_exec_amf_componentunregister;
 	struct iovec iovecs[2];
-	int result;
 	struct saAmfComponent *component;
 
 	req_exec_amf_componentunregister.header.size = sizeof (struct req_exec_amf_componentunregister);
@@ -2060,7 +2058,7 @@ static int message_handler_req_amf_componentunregister (struct conn_info *conn_i
 	iovecs[0].iov_base = (char *)&req_exec_amf_componentunregister;
 	iovecs[0].iov_len = sizeof (req_exec_amf_componentunregister);
 
-	result = gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 
 	return (0);
 }
@@ -2218,7 +2216,6 @@ static int message_handler_req_amf_errorreport (struct conn_info *conn_info, voi
 	struct req_exec_amf_errorreport req_exec_amf_errorreport;
 
 	struct iovec iovecs[2];
-	int result;
 
 	req_exec_amf_errorreport.header.size = sizeof (struct req_exec_amf_errorreport);
 	req_exec_amf_errorreport.header.id = MESSAGE_REQ_EXEC_AMF_ERRORREPORT;
@@ -2236,7 +2233,7 @@ static int message_handler_req_amf_errorreport (struct conn_info *conn_info, voi
 //	iovecs[1].iov_base = (char *)&req_lib_amf_errorreport;
 //	iovecs[1].iov_len = sizeof (req_lib_amf_errorreport);
 
-	result = gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 
 	return (0);
 }
@@ -2247,7 +2244,6 @@ static int message_handler_req_amf_errorcancelall (struct conn_info *conn_info,
 	struct req_exec_amf_errorcancelall req_exec_amf_errorcancelall;
 
 	struct iovec iovecs[2];
-	int result;
 
 	req_exec_amf_errorcancelall.header.size = sizeof (struct req_exec_amf_errorcancelall);
 	req_exec_amf_errorcancelall.header.id = MESSAGE_REQ_EXEC_AMF_ERRORCANCELALL;
@@ -2265,7 +2261,7 @@ static int message_handler_req_amf_errorcancelall (struct conn_info *conn_info,
 //	iovecs[1].iov_base = (char *)&req_lib_amf_errorcancelall;
 //	iovecs[1].iov_len = sizeof (req_lib_amf_errorcancelall);
 
-	result = gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 
 	return (0);
 }

+ 18 - 21
exec/ckpt.c

@@ -427,7 +427,7 @@ int sendCkptCheckpointClose (struct saCkptCheckpoint *checkpoint) {
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointclose);
 
 	if (gmi_send_ok (GMI_PRIO_HIGH, sizeof (struct req_exec_ckpt_checkpointclose))) {
-		gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_HIGH);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_HIGH) == 0);
 		return (0);
 	}
 
@@ -624,7 +624,6 @@ void timer_function_retention (void *data)
 {
 	struct saCkptCheckpoint *checkpoint = (struct saCkptCheckpoint *)data;
 	struct req_exec_ckpt_checkpointretentiondurationexpire req_exec_ckpt_checkpointretentiondurationexpire;
-	int result;
 	struct iovec iovec;
 
 	checkpoint->retention_timer = 0;
@@ -639,7 +638,7 @@ void timer_function_retention (void *data)
 	iovec.iov_base = (char *)&req_exec_ckpt_checkpointretentiondurationexpire;
 	iovec.iov_len = sizeof (req_exec_ckpt_checkpointretentiondurationexpire);
 
-	result = gmi_mcast (&aisexec_groupname, &iovec, 1, GMI_PRIO_MED);
+	assert (gmi_mcast (&aisexec_groupname, &iovec, 1, GMI_PRIO_MED) == 0);
 }
 
 extern int message_handler_req_exec_ckpt_checkpointclose (void *message, struct in_addr source_addr)
@@ -785,7 +784,7 @@ static int message_handler_req_exec_ckpt_checkpointretentiondurationexpire (void
 		iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointunlink;
 		iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointunlink);
 
-		gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 	}
 	return (0);
 }
@@ -1328,7 +1327,6 @@ static int message_handler_req_lib_ckpt_checkpointopen (struct conn_info *conn_i
 	struct req_lib_ckpt_checkpointopen *req_lib_ckpt_checkpointopen = (struct req_lib_ckpt_checkpointopen *)message;
 	struct req_exec_ckpt_checkpointopen req_exec_ckpt_checkpointopen;
 	struct iovec iovecs[2];
-	int result;
 
 	log_printf (LOG_LEVEL_DEBUG, "Library request to open checkpoint.\n");
 	req_exec_ckpt_checkpointopen.header.size =
@@ -1345,7 +1343,7 @@ static int message_handler_req_lib_ckpt_checkpointopen (struct conn_info *conn_i
 	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointopen;
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointopen);
 
-	result = gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 
 	return (0);
 }
@@ -1361,7 +1359,6 @@ static int message_handler_req_lib_ckpt_checkpointunlink (struct conn_info *conn
 	struct req_lib_ckpt_checkpointunlink *req_lib_ckpt_checkpointunlink = (struct req_lib_ckpt_checkpointunlink *)message;
 	struct req_exec_ckpt_checkpointunlink req_exec_ckpt_checkpointunlink;
 	struct iovec iovecs[2];
-	int result;
 
 	req_exec_ckpt_checkpointunlink.header.size =
 		sizeof (struct req_exec_ckpt_checkpointunlink);
@@ -1377,7 +1374,7 @@ static int message_handler_req_lib_ckpt_checkpointunlink (struct conn_info *conn
 	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointunlink;
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointunlink);
 
-	result = gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 
 	return (0);
 }
@@ -1403,7 +1400,7 @@ static int message_handler_req_lib_ckpt_checkpointretentiondurationset (struct c
 	iovecs[0].iov_base = (char *)&req_exec_ckpt_checkpointretentiondurationset;
 	iovecs[0].iov_len = sizeof (req_exec_ckpt_checkpointretentiondurationset);
 
-	gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW);
+	assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW) == 0);
 
 	return (0);
 }
@@ -1521,9 +1518,9 @@ printf ("|\n");
 #endif
 	if (iovecs[1].iov_len > 0) {
 		log_printf (LOG_LEVEL_DEBUG, "IOV_BASE is %s\n", iovecs[1].iov_base);
-		gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_MED);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_MED) == 0);
 	} else {
-		gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 	}
 
 	return (0);
@@ -1561,9 +1558,9 @@ static int message_handler_req_lib_ckpt_sectiondelete (struct conn_info *conn_in
 	iovecs[1].iov_len = req_lib_ckpt_sectiondelete->header.size - sizeof (struct req_lib_ckpt_sectiondelete);
 
 	if (iovecs[1].iov_len > 0) {
-		gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_MED);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_MED) == 0);
 	} else {
-		gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_MED) == 0);
 	}
 
 	return (0);
@@ -1601,9 +1598,9 @@ static int message_handler_req_lib_ckpt_sectionexpirationtimeset (struct conn_in
 
 	if (iovecs[1].iov_len > 0) {
 		log_printf (LOG_LEVEL_DEBUG, "IOV_BASE is %s\n", iovecs[1].iov_base);
-		gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW) == 0);
 	} else {
-		gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW) == 0);
 	}
 
 	return (0);
@@ -1659,9 +1656,9 @@ static int message_handler_req_lib_ckpt_sectionwrite (struct conn_info *conn_inf
 
 //printf ("LIB writing checkpoint section is %s\n", ((char *)req_lib_ckpt_sectionwrite) + sizeof (struct req_lib_ckpt_sectionwrite));
 	if (iovecs[1].iov_len > 0) {
-		gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW) == 0);
 	} else {
-		gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW) == 0);
 	}
 
 	return (0);
@@ -1714,9 +1711,9 @@ static int message_handler_req_lib_ckpt_sectionoverwrite (struct conn_info *conn
 	iovecs[1].iov_len = req_lib_ckpt_sectionoverwrite->header.size - sizeof (struct req_lib_ckpt_sectionoverwrite);
 
 	if (iovecs[1].iov_len > 0) {
-		gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW) == 0);
 	} else {
-		gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW) == 0);
 	}
 
 	return (0);
@@ -1769,9 +1766,9 @@ static int message_handler_req_lib_ckpt_sectionread (struct conn_info *conn_info
 	iovecs[1].iov_len = req_lib_ckpt_sectionread->header.size - sizeof (struct req_lib_ckpt_sectionread);
 
 	if (iovecs[1].iov_len > 0) {
-		gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 2, GMI_PRIO_LOW) == 0);
 	} else {
-		gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW);
+		assert (gmi_mcast (&aisexec_groupname, iovecs, 1, GMI_PRIO_LOW) == 0);
 	}
 
 	return (0);

+ 4 - 4
exec/evs.c

@@ -351,8 +351,8 @@ static int message_handler_req_evs_mcast_joined (struct conn_info *conn_info, vo
 	req_exec_evs_mcast_iovec[2].iov_base = &req_lib_evs_mcast_joined->msg;
 	req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_joined->msg_len;
 	
-	gmi_mcast (&aisexec_groupname, req_exec_evs_mcast_iovec, 3,
-		req_lib_evs_mcast_joined->priority);
+	assert (gmi_mcast (&aisexec_groupname, req_exec_evs_mcast_iovec, 3,
+		req_lib_evs_mcast_joined->priority) == 0);
 
 	res_lib_evs_mcast_joined.header.size = sizeof (struct res_lib_evs_mcast_joined);
 	res_lib_evs_mcast_joined.header.id = MESSAGE_RES_EVS_MCAST_JOINED;
@@ -389,8 +389,8 @@ static int message_handler_req_evs_mcast_groups (struct conn_info *conn_info, vo
 	req_exec_evs_mcast_iovec[2].iov_base = msg_addr;
 	req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_groups->msg_len;
 	
-	gmi_mcast (&aisexec_groupname, req_exec_evs_mcast_iovec, 3,
-		req_lib_evs_mcast_groups->priority);
+	assert (gmi_mcast (&aisexec_groupname, req_exec_evs_mcast_iovec, 3,
+		req_lib_evs_mcast_groups->priority) == 0);
 
 	res_lib_evs_mcast_groups.header.size = sizeof (struct res_lib_evs_mcast_groups);
 	res_lib_evs_mcast_groups.header.id = MESSAGE_RES_EVS_MCAST_GROUPS;