[tracker/wip/carlosg/domain-ontologies: 31/39] libtracker-bus: Move tracker-store ping call here



commit 7ce705db506ea4a2c7f425158c41ad71a7a9a303
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Jun 4 18:40:03 2017 +0200

    libtracker-bus: Move tracker-store ping call here
    
    We just need this if we have a bus-based connection at all.

 src/libtracker-bus/tracker-bus.vala                |    9 +++++
 src/libtracker-sparql-backend/tracker-backend.vala |   33 --------------------
 2 files changed, 9 insertions(+), 33 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-bus.vala b/src/libtracker-bus/tracker-bus.vala
index 527a9e1..544c221 100644
--- a/src/libtracker-bus/tracker-bus.vala
+++ b/src/libtracker-bus/tracker-bus.vala
@@ -23,6 +23,15 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
        public Connection () throws Sparql.Error, IOError, DBusError {
                bus = GLib.Bus.get_sync (Tracker.IPC.bus ());
 
+               debug ("Waiting for service to become available...");
+
+               // do not use proxy to work around race condition in GDBus
+               // NB#259760
+               var msg = new DBusMessage.method_call (Tracker.DBUS_SERVICE, Tracker.DBUS_OBJECT_STATUS, 
Tracker.DBUS_INTERFACE_STATUS, "Wait");
+               bus.send_message_with_reply_sync (msg, 0, /* timeout */ int.MAX, null).to_gerror ();
+
+               debug ("Service is ready");
+
                // ensure that error domain is registered with GDBus
                new Sparql.Error.INTERNAL ("");
        }
diff --git a/src/libtracker-sparql-backend/tracker-backend.vala 
b/src/libtracker-sparql-backend/tracker-backend.vala
index 4d176ab..8d3c7db 100644
--- a/src/libtracker-sparql-backend/tracker-backend.vala
+++ b/src/libtracker-sparql-backend/tracker-backend.vala
@@ -26,27 +26,10 @@ class Tracker.Sparql.Backend : Connection {
                DIRECT,
                BUS
        }
-       GLib.BusType bus_type = BusType.SESSION;
 
        public Backend () throws Sparql.Error, IOError, DBusError, SpawnError {
                try {
-                       // Important to make sure we check the right bus for the store
-                       load_env ();
-
-                       // Makes sure the sevice is available
-                       debug ("Waiting for service to become available...");
-
-                       // do not use proxy to work around race condition in GDBus
-                       // NB#259760
-                       var bus = GLib.Bus.get_sync (bus_type);
-                       var msg = new DBusMessage.method_call (Tracker.DBUS_SERVICE, 
Tracker.DBUS_OBJECT_STATUS, Tracker.DBUS_INTERFACE_STATUS, "Wait");
-                       bus.send_message_with_reply_sync (msg, 0, /* timeout */ int.MAX, null).to_gerror ();
-
-                       debug ("Service is ready");
-
-                       debug ("Constructing connection");
                        load_plugins ();
-                       debug ("Backend is ready");
                } catch (GLib.Error e) {
                        throw new Sparql.Error.INTERNAL (e.message);
                }
@@ -54,22 +37,6 @@ class Tracker.Sparql.Backend : Connection {
                initialized = true;
        }
 
-       private void load_env () {
-               string env_bus_type = Environment.get_variable ("TRACKER_BUS_TYPE");
-
-               if (env_bus_type != null) {
-                       if (env_bus_type.ascii_casecmp ("system") == 0) {
-                               bus_type = BusType.SYSTEM;
-                               debug ("Using bus = 'SYSTEM'");
-                       } else if (env_bus_type.ascii_casecmp ("session") == 0) {
-                               bus_type = BusType.SESSION;
-                               debug ("Using bus = 'SESSION'");
-                       } else {
-                               warning ("Environment variable TRACKER_BUS_TYPE set to unknown value '%s'", 
env_bus_type);
-                       }
-               }
-       }
-
        public override void dispose () {
                // trying to lock on partially initialized instances will deadlock
                if (initialized) {


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