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

Properly check result of coroipcc_dispatch_put

When result of coroipcc_dispatch_put it can happen, that one message is
delivered to user application multiple times.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Jan Friesse 13 лет назад
Родитель
Сommit
dc31a079e8
6 измененных файлов с 48 добавлено и 18 удалено
  1. 8 3
      lib/cfg.c
  2. 8 3
      lib/confdb.c
  3. 8 3
      lib/cpg.c
  4. 8 3
      lib/evs.c
  5. 8 3
      lib/quorum.c
  6. 8 3
      lib/votequorum.c

+ 8 - 3
lib/cfg.c

@@ -210,12 +210,17 @@ corosync_cfg_dispatch (
 			callbacks.corosync_cfg_shutdown_callback(cfg_handle, res_lib_cfg_testshutdown->flags);
 			break;
 		default:
-			coroipcc_dispatch_put (cfg_instance->handle);
-			error = CS_ERR_LIBRARY;
+			error = coroipcc_dispatch_put (cfg_instance->handle);
+			if (error == CS_OK) {
+				error = CS_ERR_LIBRARY;
+			}
 			goto error_put;
 			break;
 		}
-		coroipcc_dispatch_put (cfg_instance->handle);
+		error = coroipcc_dispatch_put (cfg_instance->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed

+ 8 - 3
lib/confdb.c

@@ -416,12 +416,17 @@ cs_error_t confdb_dispatch (
 				break;
 
 			default:
-				coroipcc_dispatch_put (confdb_inst->handle);
-				error = CS_ERR_LIBRARY;
+				error = coroipcc_dispatch_put (confdb_inst->handle);
+				if (error == CS_OK) {
+					error = CS_ERR_LIBRARY;
+				}
 				goto error_put;
 				break;
 		}
-		coroipcc_dispatch_put (confdb_inst->handle);
+		error = coroipcc_dispatch_put (confdb_inst->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed

+ 8 - 3
lib/cpg.c

@@ -451,14 +451,19 @@ cs_error_t cpg_dispatch (
 					totem_member_list);
 				break;
 			default:
-				coroipcc_dispatch_put (cpg_inst->handle);
-				error = CS_ERR_LIBRARY;
+				error = coroipcc_dispatch_put (cpg_inst->handle);
+				if (error == CS_OK) {
+					error = CS_ERR_LIBRARY;
+				}
 				goto error_put;
 				break;
 			} /* - switch (dispatch_data->id) */
 			break; /* case CPG_MODEL_V1 */
 		} /* - switch (cpg_inst_copy.model_data.model) */
-		coroipcc_dispatch_put (cpg_inst->handle);
+		error = coroipcc_dispatch_put (cpg_inst->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed

+ 8 - 3
lib/evs.c

@@ -308,12 +308,17 @@ evs_error_t evs_dispatch (
 			break;
 
 		default:
-			coroipcc_dispatch_put (evs_inst->handle);
-			error = CS_ERR_LIBRARY;
+			error = coroipcc_dispatch_put (evs_inst->handle);
+			if (error == CS_OK) {
+				error = CS_ERR_LIBRARY;
+			}
 			goto error_put;
 			break;
 		}
-		coroipcc_dispatch_put (evs_inst->handle);
+		error = coroipcc_dispatch_put (evs_inst->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed

+ 8 - 3
lib/quorum.c

@@ -399,12 +399,17 @@ cs_error_t quorum_dispatch (
 			break;
 
 		default:
-			coroipcc_dispatch_put (quorum_inst->handle);
-			error = CS_ERR_LIBRARY;
+			error = coroipcc_dispatch_put (quorum_inst->handle);
+			if (error == CS_OK) {
+				error = CS_ERR_LIBRARY;
+			}
 			goto error_put;
 			break;
 		}
-		coroipcc_dispatch_put (quorum_inst->handle);
+		error = coroipcc_dispatch_put (quorum_inst->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed

+ 8 - 3
lib/votequorum.c

@@ -766,12 +766,17 @@ cs_error_t votequorum_dispatch (
 			break;
 
 		default:
-			coroipcc_dispatch_put (votequorum_inst->handle);
-			error = CS_ERR_LIBRARY;
+			error = coroipcc_dispatch_put (votequorum_inst->handle);
+			if (error == CS_OK) {
+				error = CS_ERR_LIBRARY;
+			}
 			goto error_put;
 			break;
 		}
-		coroipcc_dispatch_put (votequorum_inst->handle);
+		error = coroipcc_dispatch_put (votequorum_inst->handle);
+		if (error != CS_OK) {
+			goto error_put;
+		}
 
 		/*
 		 * Determine if more messages should be processed