[rygel] core: Add env variable to change plugin timeout



commit 3636b7e882e039ceaf9429b67b630def902ad510
Author: Jens Georg <mail jensge org>
Date:   Thu Feb 9 10:54:39 2012 +0200

    core: Add env variable to change plugin timeout
    
    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         |    8 ++++++++
 src/rygel/rygel-main.vala |   11 ++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/doc/man/rygel.xml b/doc/man/rygel.xml
index a37e800..a22aaaf 100644
--- a/doc/man/rygel.xml
+++ b/doc/man/rygel.xml
@@ -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>
diff --git a/src/rygel/rygel-main.vala b/src/rygel/rygel-main.vala
index fc8fbc8..453529d 100644
--- a/src/rygel/rygel-main.vala
+++ b/src/rygel/rygel-main.vala
@@ -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..",



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