[rygel] core: Timeout on plugin loading



commit 4ce7b33892bb8962ff45227cd59d68eecd4e56c7
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue May 25 03:21:13 2010 +0300

    core: Timeout on plugin loading
    
    Rygel just keeps running even if there is no plugin available. This has
    confused many users in the past. Enough is enough, Rygel now exits if it
    fails to load any plugins in 5 seconds.

 src/rygel/rygel-main.vala |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-main.vala b/src/rygel/rygel-main.vala
index 1899315..140f61c 100644
--- a/src/rygel/rygel-main.vala
+++ b/src/rygel/rygel-main.vala
@@ -26,6 +26,8 @@ using Gee;
 using GUPnP;
 
 public class Rygel.Main : Object {
+    private static int PLUGIN_TIMEOUT = 5;
+
     private PluginLoader plugin_loader;
     private ContextManager context_manager;
     private ArrayList <RootDeviceFactory> factories;
@@ -66,6 +68,17 @@ public class Rygel.Main : Object {
     private int run () {
         this.plugin_loader.load_plugins ();
 
+        Timeout.add_seconds (PLUGIN_TIMEOUT, () => {
+            if (this.plugin_loader.list_plugins ().size == 0) {
+                warning (_("No plugins found in %d seconds, giving up.."),
+                         PLUGIN_TIMEOUT);
+
+                this.exit (-82);
+            }
+
+            return false;
+        });
+
         this.main_loop.run ();
 
         return this.exit_code;



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