[patch] make NM survice a HAL restart



Hi,

I've attached a patch in two different flavors.  The result of both is
the same:  NetworkManager will no longer die once HAL drops off the
system message bus.

Flavor one takes care that we return DBUS_HANDLER_RESULT_HANDLED in
nm_dbus_signal_filter once HAL drops off the bus.  Otherwise it gets
ugly:  We call hal_ctx_shutdown and hal_ctx_free which wipes away our
HAL context.  Fine.  Next we return DBUS_HANDLER_RESULT_NOT_YET_HANDLED.
This causes NM to die since libdbus (dbus_connection_dispatch) tries to
call the filter function of the already gone HAL context.

The second flavor is another approach to fix this issue.  Actually, once
HAL drops off we are not required to destroy our HAL context at all.
Since all matches and the filter function are added by libhal we're
still sane and get all messages once HAL is back on the bus.

Personally I'd go for the first approach.

   Timo

Patch (flavor 1): nm-hal-restart-thoenig-01.patch
ChangeLog                |    8 ++++++++
src/NetworkManagerDbus.c |    6 ++++++
2 files changed, 14 insertions(+)

Patch (flavor 2): nm-hal-restart-thoenig-02.patch
ChangeLog                |    7 +++++++
src/NetworkManagerDbus.c |    5 +++--
2 files changed, 10 insertions(+), 2 deletions(-)
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/NetworkManager/ChangeLog,v
retrieving revision 1.656
diff -u -r1.656 ChangeLog
--- ChangeLog	15 Dec 2005 06:00:45 -0000	1.656
+++ ChangeLog	15 Dec 2005 12:43:13 -0000
@@ -1,3 +1,11 @@
+2005-12-15  Timo Hoenig  <thoenig suse de>
+
+	* src/NetworkManagerDbus.c
+		- (nm_dbus_signal_filter) return DBUS_HANDLER_RESULT_HANDLED
+			if HAL jumps off the system bus.  Otherwise libdbus
+			(dbus_connection_dispatch) will try to run the filter
+			function of our libhal context which is already freed.
+
 2005-12-15  Alexander Shopov  <ash contact bg>
 
 	* configure.in: Added "bg" (Bulgarian) to ALL_LINGUAS

Index: src/NetworkManagerDbus.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/NetworkManagerDbus.c,v
retrieving revision 1.97
diff -u -r1.97 NetworkManagerDbus.c
--- src/NetworkManagerDbus.c	14 Dec 2005 14:56:04 -0000	1.97
+++ src/NetworkManagerDbus.c	15 Dec 2005 12:14:02 -0000
@@ -1074,9 +1074,15 @@
 			else if (strcmp (service, "org.freedesktop.Hal") == 0)
 			{
 				if (!old_owner_good && new_owner_good) /* Hal just appeared */
+				{
 					nm_hal_init (data);
+					handled = TRUE;
+				}
 				else if (old_owner_good && !new_owner_good)	/* Hal went away */
+				{
 					nm_hal_deinit (data);
+					handled = TRUE;
+				}
 			}
 			else if (nm_dhcp_manager_process_name_owner_changed (data->dhcp_manager, service, old_owner, new_owner) == TRUE)
 				handled = TRUE;

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/NetworkManager/ChangeLog,v
retrieving revision 1.656
diff -u -r1.656 ChangeLog
--- ChangeLog	15 Dec 2005 06:00:45 -0000	1.656
+++ ChangeLog	15 Dec 2005 12:45:17 -0000
@@ -1,3 +1,10 @@
+2005-12-15  Timo Hoenig  <thoenig suse de>
+
+	* src/NetworkManagerDbus.c
+		- (nm_dbus_signal_filter) don't destory HAL context once
+			HAL jumps off the system bus.  We don't need to destroy
+			our HAL context if the HAL daemon gets restarted.
+
 2005-12-15  Alexander Shopov  <ash contact bg>
 
 	* configure.in: Added "bg" (Bulgarian) to ALL_LINGUAS

Index: src/NetworkManagerDbus.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/NetworkManagerDbus.c,v
retrieving revision 1.97
diff -u -r1.97 NetworkManagerDbus.c
--- src/NetworkManagerDbus.c	14 Dec 2005 14:56:04 -0000	1.97
+++ src/NetworkManagerDbus.c	15 Dec 2005 12:14:15 -0000
@@ -1074,9 +1074,10 @@
 			else if (strcmp (service, "org.freedesktop.Hal") == 0)
 			{
 				if (!old_owner_good && new_owner_good) /* Hal just appeared */
+				{
 					nm_hal_init (data);
-				else if (old_owner_good && !new_owner_good)	/* Hal went away */
-					nm_hal_deinit (data);
+					handled = TRUE;
+				}
 			}
 			else if (nm_dhcp_manager_process_name_owner_changed (data->dhcp_manager, service, old_owner, new_owner) == TRUE)
 				handled = TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]