[tracker-miners/sam/fix-domain-watches] Revert "miners: Fix tracker-store DBus name watch along miners"



commit 42585e890cd775e92ee191349ecd1d68095daeaf
Author: Sam Thursfield <sam afuera me uk>
Date:   Sun Sep 30 13:30:42 2018 +0200

    Revert "miners: Fix tracker-store DBus name watch along miners"
    
    This reverts commit ab29a9cd6afb8935ff2b852f37a3f8cb37e293d1.
    
    The name watch was correct in the first place. This also
    reverts the two cleanup attempts f9e7de0fe0 and 8b6bc5b71f7be3af5.

 src/miners/apps/tracker-main.c     | 11 +++++++++--
 src/miners/fs/tracker-main.c       | 11 +++++++++--
 src/miners/rss/tracker-main.c      |  9 ++++++++-
 src/tracker-extract/tracker-main.c | 11 +++++++++--
 4 files changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/src/miners/apps/tracker-main.c b/src/miners/apps/tracker-main.c
index ecf85b784..5a482d04a 100644
--- a/src/miners/apps/tracker-main.c
+++ b/src/miners/apps/tracker-main.c
@@ -186,7 +186,7 @@ main (gint argc, gchar *argv[])
        GDBusConnection *connection;
        TrackerMinerProxy *proxy;
        TrackerDomainOntology *domain_ontology;
-       gchar *dbus_name;
+       gchar *domain_name, *dbus_name;
 
        main_loop = NULL;
 
@@ -249,10 +249,17 @@ main (gint argc, gchar *argv[])
        main_loop = g_main_loop_new (NULL, FALSE);
 
        if (domain_ontology && domain_ontology_name) {
-               g_bus_watch_name_on_connection (connection, domain_ontology_name,
+               /* If we are running for a specific domain, we tie the lifetime of this
+                * process to the domain. For example, if the domain name is
+                * org.example.MyApp then this tracker-miner-apps process will exit as
+                * soon as org.example.MyApp exits.
+                */
+               domain_name = tracker_domain_ontology_get_domain (domain_ontology, NULL);
+               g_bus_watch_name_on_connection (connection, domain_name,
                                                G_BUS_NAME_WATCHER_FLAGS_NONE,
                                                NULL, on_domain_vanished,
                                                main_loop, NULL);
+               g_free (domain_name);
        }
 
        g_message ("Checking if we're running as a daemon:");
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 9acaeef99..9bdbb8f0a 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -667,7 +667,7 @@ main (gint argc, gchar *argv[])
        TrackerMinerProxy *proxy;
        GDBusConnection *connection;
        TrackerDomainOntology *domain_ontology;
-       gchar *dbus_name;
+       gchar *domain_name, *dbus_name;
 
        main_loop = NULL;
 
@@ -750,10 +750,17 @@ main (gint argc, gchar *argv[])
        main_loop = g_main_loop_new (NULL, FALSE);
 
        if (domain_ontology && domain_ontology_name) {
-               g_bus_watch_name_on_connection (connection, domain_ontology_name,
+               /* If we are running for a specific domain, we tie the lifetime of this
+                * process to the domain. For example, if the domain name is
+                * org.example.MyApp then this tracker-miner-fs process will exit as
+                * soon as org.example.MyApp exits.
+                */
+               domain_name = tracker_domain_ontology_get_domain (domain_ontology, NULL);
+               g_bus_watch_name_on_connection (connection, domain_name,
                                                G_BUS_NAME_WATCHER_FLAGS_NONE,
                                                NULL, on_domain_vanished,
                                                main_loop, NULL);
+               g_free (domain_name);
        }
 
        g_message ("Checking if we're running as a daemon:");
diff --git a/src/miners/rss/tracker-main.c b/src/miners/rss/tracker-main.c
index 152b16241..e6e6d30af 100644
--- a/src/miners/rss/tracker-main.c
+++ b/src/miners/rss/tracker-main.c
@@ -79,7 +79,7 @@ main (int argc, char **argv)
        GDBusConnection *connection;
        TrackerMinerProxy *proxy;
        TrackerDomainOntology *domain_ontology;
-       gchar *dbus_name;
+       gchar *domain_name, *dbus_name;
 
        setlocale (LC_ALL, "");
 
@@ -218,10 +218,17 @@ main (int argc, char **argv)
        loop = g_main_loop_new (NULL, FALSE);
 
        if (domain_ontology && domain_ontology_name) {
+               /* If we are running for a specific domain, we tie the lifetime of this
+                * process to the domain. For example, if the domain name is
+                * org.example.MyApp then this tracker-miner-rss process will exit as
+                * soon as org.example.MyApp exits.
+                */
+               domain_name = tracker_domain_ontology_get_domain (domain_ontology, NULL);
                g_bus_watch_name_on_connection (connection, domain_ontology_name,
                                                G_BUS_NAME_WATCHER_FLAGS_NONE,
                                                NULL, on_domain_vanished,
                                                loop, NULL);
+               g_free (domain_name);
        }
 
        g_main_loop_run (loop);
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index 52c2c8c44..958d00061 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -351,7 +351,7 @@ main (int argc, char *argv[])
        GDBusConnection *connection;
        TrackerMinerProxy *proxy;
        TrackerDomainOntology *domain_ontology;
-       gchar *dbus_name;
+       gchar *domain_name, *dbus_name;
 
        bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -495,10 +495,17 @@ main (int argc, char *argv[])
        main_loop = g_main_loop_new (NULL, FALSE);
 
        if (domain_ontology && domain_ontology_name) {
-               g_bus_watch_name_on_connection (connection, domain_ontology_name,
+               /* If we are running for a specific domain, we tie the lifetime of this
+                * process to the domain. For example, if the domain name is
+                * org.example.MyApp then this tracker-extract process will exit as
+                * soon as org.example.MyApp exits.
+                */
+               domain_name = tracker_domain_ontology_get_domain (domain_ontology, NULL);
+               g_bus_watch_name_on_connection (connection, domain_name,
                                                G_BUS_NAME_WATCHER_FLAGS_NONE,
                                                NULL, on_domain_vanished,
                                                main_loop, NULL);
+               g_free (domain_name);
        }
 
        g_signal_connect (decorator, "finished",


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