tracker r1168 - trunk/src/trackerd



Author: jamiemcc
Date: Thu Feb 28 01:14:46 2008
New Revision: 1168
URL: http://svn.gnome.org/viewvc/tracker?rev=1168&view=rev

Log:
fixed dbus shutdown operation

Modified:
   trunk/src/trackerd/tracker-dbus-methods.c
   trunk/src/trackerd/tracker-dbus.c
   trunk/src/trackerd/trackerd.c

Modified: trunk/src/trackerd/tracker-dbus-methods.c
==============================================================================
--- trunk/src/trackerd/tracker-dbus-methods.c	(original)
+++ trunk/src/trackerd/tracker-dbus-methods.c	Thu Feb 28 01:14:46 2008
@@ -597,6 +597,8 @@
 		return;
 	}
 
+	tracker_log ("attempting restart");
+
 	tracker->reindex = reindex;
 
 	g_timeout_add (500, (GSourceFunc) tracker_do_cleanup, NULL);

Modified: trunk/src/trackerd/tracker-dbus.c
==============================================================================
--- trunk/src/trackerd/tracker-dbus.c	(original)
+++ trunk/src/trackerd/tracker-dbus.c	Thu Feb 28 01:14:46 2008
@@ -286,6 +286,44 @@
 		return DBUS_HANDLER_RESULT_HANDLED;
 	}
 
+	/* process shutdown calls in this thread */
+	if (dbus_message_is_method_call (message, TRACKER_INTERFACE, TRACKER_METHOD_SHUTDOWN)) {
+	
+		DBusMessage 	*reply;
+		DBusError   	dbus_error;
+		gboolean 	reindex = FALSE;
+	
+		if (!dbus_message_get_args (message, NULL, DBUS_TYPE_BOOLEAN, &reindex, DBUS_TYPE_INVALID)) {
+			//tracker_set_error (rec, "DBusError: %s;%s", dbus_error.name, dbus_error.message);
+			dbus_error_free (&dbus_error);
+			return 0;
+		}
+
+		tracker_log ("attempting restart");
+
+		tracker->reindex = reindex;
+		
+		tracker->is_running = FALSE;
+		tracker_end_watching ();
+
+		g_timeout_add_full (G_PRIORITY_LOW,
+		     		    1,
+	 	    		    (GSourceFunc) tracker_do_cleanup,
+		     		    g_strdup ("dbus shutdown"), NULL
+		   		    );
+
+
+		reply = dbus_message_new_method_return (message);
+
+		dbus_connection_send (conn, reply, NULL);
+
+		dbus_message_unref (reply);
+	
+		return DBUS_HANDLER_RESULT_HANDLED;
+	
+	}
+	
+
 
 	if (dbus_message_is_method_call (message, TRACKER_INTERFACE, TRACKER_METHOD_PING)) {
 		/* ref the message here because we are going to reply to it in a different thread */

Modified: trunk/src/trackerd/trackerd.c
==============================================================================
--- trunk/src/trackerd/trackerd.c	(original)
+++ trunk/src/trackerd/trackerd.c	Thu Feb 28 01:14:46 2008
@@ -354,6 +354,8 @@
 {
 	tracker->status = STATUS_SHUTDOWN;
 
+	tracker_log ("shutdown mode entered");
+
 	if (tracker->log_file && sig_msg) {
 		tracker_log ("Received signal '%s' so now shutting down", sig_msg);
 
@@ -1783,6 +1785,7 @@
                                 break;
 
                         case DBUS_ACTION_SHUTDOWN:
+                                           	
 
 				tracker_dbus_method_shutdown (rec);
 



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