core: Add env variable to change plugin timeout
authorJens Georg <mail@jensge.org>
Thu, 9 Feb 2012 08:54:39 +0000 (10:54 +0200)
committerJens Georg <mail@jensge.org>
Thu, 9 Feb 2012 10:06:01 +0000 (12:06 +0200)
Especially when running inside valgrind the 5 second timeout is too
short and often rygel fails to load its plugins in time and terminates
itself.

doc/man/rygel.xml
src/rygel/rygel-main.vala

index a37e800..a22aaaf 100644 (file)
@@ -498,6 +498,14 @@ handling.</para>
           <para>Disable remote file deletion via UPnP.</para>
         </listitem>
       </varlistentry>
+      <varlistentry>
+        <term>
+          <envar>RYGEL_PLUGIN_TIMEOUT</envar>
+        </term>
+        <listitem>
+          <para>Set the time-out for finding the plugins. Useful to increase when running inside valgrind.</para>
+        </listitem>
+      </varlistentry>
     </variablelist>
     <para>Also for every plugin you can set the following environment variables:</para>
     <para><variablelist>
index fc8fbc8..453529d 100644 (file)
@@ -83,7 +83,16 @@ public class Rygel.Main : Object {
         this.context_manager = this.create_context_manager ();
         this.plugin_loader.load_plugins ();
 
-        Timeout.add_seconds (PLUGIN_TIMEOUT, () => {
+        var timeout = PLUGIN_TIMEOUT;
+        try {
+            var config = MetaConfig.get_default ();
+            timeout = config.get_int ("plugin",
+                                      "TIMEOUT",
+                                      PLUGIN_TIMEOUT,
+                                      int.MAX);
+        } catch (Error error) {};
+
+        Timeout.add_seconds (timeout, () => {
             if (this.plugin_loader.list_plugins ().size == 0) {
                 warning (ngettext ("No plugins found in %d second; giving up..",
                                    "No plugins found in %d seconds; giving up..",