Преглед изворни кода

Fix a couple of small bugs that happen when the configuration is reloaded.

1. the reload callback was not sent to the library,
2. totem exponentially added new callbacks because the old ones were not
   removed properly.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2684 fd59a12c-fef9-0310-b244-a6a79926bd2f
Christine Caulfield пре 16 година
родитељ
комит
576614109e
2 измењених фајлова са 14 додато и 4 уклоњено
  1. 2 1
      exec/objdb.c
  2. 12 3
      exec/totemconfig.c

+ 2 - 1
exec/objdb.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2006 MontaVista Software, Inc.
- * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Copyright (c) 2007-2010 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -352,6 +352,7 @@ static void object_reload_notification(int startstop, int flush)
 			if (tmptracker_pt) {
 				list_add(&tmptracker_pt->object_list, &tmplist);
 				tmptracker_pt->object_reload_notify_fn = tracker_pt->object_reload_notify_fn;
+				tmptracker_pt->data_pt = tracker_pt->data_pt;
 			}
 		}
 	}

+ 12 - 3
exec/totemconfig.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2002-2005 MontaVista Software, Inc.
- * Copyright (c) 2006-2009 Red Hat, Inc.
+ * Copyright (c) 2006-2010 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -818,6 +818,9 @@ static void totem_objdb_reload_notify(objdb_reload_notify_type_t type, int flush
 	struct totem_config *totem_config = priv_data_pt;
 	hdb_handle_t totem_object_handle;
 
+	if (totem_config == NULL)
+	        return;
+
 	/*
 	 * A new totem {} key might exist, cancel the
 	 * existing notification at the start of reload,
@@ -831,7 +834,7 @@ static void totem_objdb_reload_notify(objdb_reload_notify_type_t type, int flush
 			NULL,
 			NULL,
 			NULL,
-			NULL);
+			totem_config);
 	}
 
 	if (type == OBJDB_RELOAD_NOTIFY_END ||
@@ -840,8 +843,14 @@ static void totem_objdb_reload_notify(objdb_reload_notify_type_t type, int flush
 
 		if (!totem_handle_find(global_objdb,
 				      &totem_object_handle)) {
-			add_totem_config_notification(global_objdb, totem_config, totem_object_handle);
 
+		        global_objdb->object_track_start(totem_object_handle,
+						  1,
+						  totem_key_change_notify,
+						  NULL, // object_create_notify,
+						  NULL, // object_destroy_notify,
+						  NULL, // object_reload_notify
+						  totem_config); // priv_data
 			/*
 			 * Reload the configuration
 			 */