tracker r1637 - in branches/indexer-split: . src/trackerd
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1637 - in branches/indexer-split: . src/trackerd
- Date: Wed, 11 Jun 2008 14:55:52 +0000 (UTC)
Author: mr
Date: Wed Jun 11 14:55:52 2008
New Revision: 1637
URL: http://svn.gnome.org/viewvc/tracker?rev=1637&view=rev
Log:
* src/trackerd/tracker-daemon.c: Changed message from "restarting" to
"shuting down" when shutting down the daemon.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/trackerd/tracker-crawler.c
branches/indexer-split/src/trackerd/tracker-crawler.h
branches/indexer-split/src/trackerd/tracker-daemon.c
branches/indexer-split/src/trackerd/tracker-main.c
branches/indexer-split/src/trackerd/tracker-main.h
Modified: branches/indexer-split/src/trackerd/tracker-crawler.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-crawler.c (original)
+++ branches/indexer-split/src/trackerd/tracker-crawler.c Wed Jun 11 14:55:52 2008
@@ -57,6 +57,8 @@
guint dirs_in_progress;
guint files_found;
guint files_ignored;
+
+ gboolean running;
};
enum {
@@ -151,19 +153,16 @@
}
/* Whole file names to ignore */
- priv->ignored_names = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- NULL);
- g_hash_table_insert (priv->ignored_names, "po", GINT_TO_POINTER (1));
- g_hash_table_insert (priv->ignored_names, "CVS", GINT_TO_POINTER (1));
- g_hash_table_insert (priv->ignored_names, "Makefile", GINT_TO_POINTER (1));
- g_hash_table_insert (priv->ignored_names, "SCCS", GINT_TO_POINTER (1));
- g_hash_table_insert (priv->ignored_names, "ltmain.sh", GINT_TO_POINTER (1));
- g_hash_table_insert (priv->ignored_names, "libtool", GINT_TO_POINTER (1));
- g_hash_table_insert (priv->ignored_names, "config.status", GINT_TO_POINTER (1));
- g_hash_table_insert (priv->ignored_names, "conftest", GINT_TO_POINTER (1));
- g_hash_table_insert (priv->ignored_names, "confdefs.h", GINT_TO_POINTER (1));
+ priv->ignored_names = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (priv->ignored_names, "po", NULL);
+ g_hash_table_insert (priv->ignored_names, "CVS", NULL);
+ g_hash_table_insert (priv->ignored_names, "Makefile", NULL);
+ g_hash_table_insert (priv->ignored_names, "SCCS", NULL);
+ g_hash_table_insert (priv->ignored_names, "ltmain.sh", NULL);
+ g_hash_table_insert (priv->ignored_names, "libtool", NULL);
+ g_hash_table_insert (priv->ignored_names, "config.status", NULL);
+ g_hash_table_insert (priv->ignored_names, "conftest", NULL);
+ g_hash_table_insert (priv->ignored_names, "confdefs.h", NULL);
/* Temporary black list */
priv->temp_black_list = g_hash_table_new_full (g_str_hash,
@@ -218,8 +217,8 @@
g_strfreev (priv->ignored_prefixes);
g_strfreev (priv->ignored_suffixes);
- g_hash_table_unref (priv->temp_black_list);
- g_hash_table_unref (priv->ignored_names);
+ g_hash_table_unref (priv->temp_black_list);
+ g_hash_table_unref (priv->ignored_names);
g_slist_foreach (priv->ignored_patterns,
(GFunc) g_pattern_spec_free,
@@ -534,7 +533,8 @@
if (priv->dirs_in_progress == 0) {
g_timer_stop (priv->timer);
- g_message ("Finished crawling files in %4.4f seconds, %d found, %d ignored",
+ g_message ("%s crawling files in %4.4f seconds, %d found, %d ignored",
+ priv->running ? "Finished" : "Stopped",
g_timer_elapsed (priv->timer, NULL),
priv->files_found,
priv->files_ignored);
@@ -547,6 +547,7 @@
gpointer user_data)
{
TrackerCrawler *crawler;
+ GMainContext *context;
GFileEnumerator *enumerator;
GFileInfo *info;
GFile *parent, *child;
@@ -562,7 +563,7 @@
}
for (info = g_file_enumerator_next_file (enumerator, NULL, NULL);
- info;
+ info && crawler->priv->running;
info = g_file_enumerator_next_file (enumerator, NULL, NULL)) {
child = g_file_get_child (parent, g_file_info_get_name (info));
relative_path = g_file_get_path (child);
@@ -587,6 +588,14 @@
relative_path);
}
}
+
+ /* Iterate pending events between each file in case
+ * there are requests waiting from DBus, etc
+ */
+ context = g_main_context_default ();
+ while (g_main_context_pending (context)) {
+ g_main_context_iteration (context, FALSE);
+ }
g_object_unref (child);
}
@@ -730,6 +739,8 @@
file_queue_handle_cb,
crawler);
+ priv->running = TRUE;
+
if (0) {
get_remote_roots (crawler, NULL, NULL);
}
@@ -738,3 +749,14 @@
crawl_directory (crawler, g_get_home_dir ());
}
+void
+tracker_crawler_stop (TrackerCrawler *crawler)
+{
+ TrackerCrawlerPriv *priv;
+
+ g_return_if_fail (TRACKER_IS_CRAWLER (crawler));
+
+ priv = crawler->priv;
+
+ priv->running = FALSE;
+}
Modified: branches/indexer-split/src/trackerd/tracker-crawler.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-crawler.h (original)
+++ branches/indexer-split/src/trackerd/tracker-crawler.h Wed Jun 11 14:55:52 2008
@@ -62,6 +62,7 @@
#endif /* HAVE_HAL */
void tracker_crawler_start (TrackerCrawler *crawler);
+void tracker_crawler_stop (TrackerCrawler *crawler);
G_END_DECLS
Modified: branches/indexer-split/src/trackerd/tracker-daemon.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-daemon.c (original)
+++ branches/indexer-split/src/trackerd/tracker-daemon.c Wed Jun 11 14:55:52 2008
@@ -508,7 +508,7 @@
priv = GET_PRIV (object);
- g_message ("Tracker daemon attempting to restart");
+ g_message ("Tracker daemon attempting to shutdown");
priv->tracker->reindex = reindex;
Modified: branches/indexer-split/src/trackerd/tracker-main.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.c (original)
+++ branches/indexer-split/src/trackerd/tracker-main.c Wed Jun 11 14:55:52 2008
@@ -680,7 +680,6 @@
GOptionContext *context = NULL;
GError *error = NULL;
GSList *l;
- TrackerCrawler *crawler;
gchar *example;
gchar *summary;
gboolean need_index;
@@ -819,14 +818,14 @@
tracker_xesam_manager_init ();
tracker_email_start_email_watching (tracker_config_get_email_client (tracker->config));
- crawler = tracker_crawler_new ();
+ tracker->crawler = tracker_crawler_new ();
#ifdef HAVE_HAL
tracker->hal = tracker_hal_new ();
- tracker_crawler_set_hal (crawler, tracker->hal);
+ tracker_crawler_set_hal (tracker->crawler, tracker->hal);
#endif /* HAVE_HAL */
- tracker_crawler_set_config (crawler, tracker->config);
+ tracker_crawler_set_config (tracker->crawler, tracker->config);
umask (077);
@@ -865,7 +864,7 @@
}
/* Get files first */
- tracker_crawler_start (crawler);
+ tracker_crawler_start (tracker->crawler);
if (tracker->is_running) {
DBusGProxy *proxy;
@@ -892,8 +891,8 @@
g_message ("Shutting down...\n");
- if (crawler) {
- g_object_unref (crawler);
+ if (tracker->crawler) {
+ g_object_unref (tracker->crawler);
}
/*
@@ -947,6 +946,9 @@
void
tracker_shutdown (void)
{
+ /* Stop any tight loop operations */
+ tracker_crawler_stop (tracker->crawler);
+
g_main_loop_quit (main_loop);
}
Modified: branches/indexer-split/src/trackerd/tracker-main.h
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-main.h (original)
+++ branches/indexer-split/src/trackerd/tracker-main.h Wed Jun 11 14:55:52 2008
@@ -36,6 +36,7 @@
#include <libtracker-db/tracker-db-action.h>
+#include "tracker-crawler.h"
#include "tracker-indexer.h"
G_BEGIN_DECLS
@@ -48,6 +49,8 @@
TrackerConfig *config;
TrackerLanguage *language;
+ TrackerCrawler *crawler;
+
gboolean is_running;
gboolean readonly;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]