[rygel/wip/gapplication] Rygel: Add back plugin timeout
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/gapplication] Rygel: Add back plugin timeout
- Date: Tue, 14 Sep 2021 11:02:05 +0000 (UTC)
commit e9018359c0114a4a7f1d1e44a5052ed20f79666a
Author: Jens Georg <mail jensge org>
Date: Tue Sep 14 13:01:49 2021 +0200
Rygel: Add back plugin timeout
src/rygel/application.vala | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/src/rygel/application.vala b/src/rygel/application.vala
index 94fd2fe6..1f30d2a8 100644
--- a/src/rygel/application.vala
+++ b/src/rygel/application.vala
@@ -2,6 +2,7 @@ using Gee;
using GUPnP;
public class Rygel.Application : GLib.Application {
+ // Default time to wait for plugins showing up
private static int PLUGIN_TIMEOUT = 5;
private PluginLoader plugin_loader;
@@ -89,10 +90,36 @@ public class Rygel.Application : GLib.Application {
this.context_manager = this.create_context_manager ();
this.plugin_loader.load_modules ();
this.activation_pending = false;
+
+ var timeout = PLUGIN_TIMEOUT;
+ try {
+ var config = MetaConfig.get_default ();
+ timeout = config.get_int ("plugin",
+ "TIMEOUT",
+ 0,
+ int.MAX);
+ } catch (Error error) {};
+
+ if (timeout == 0) {
+ debug ("Plugin timeout disabled...");
+
+ return;
+ }
+
+ 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…",
+ PLUGIN_TIMEOUT),
+ PLUGIN_TIMEOUT);
+ this.release ();
+ }
+
+ return false;
+ });
}
public override void activate () {
- print ("Activate");
base.activate ();
if (this.context_manager == null || this.activation_pending) {
hold ();
@@ -114,13 +141,11 @@ public class Rygel.Application : GLib.Application {
}
public override void shutdown () {
- print ("SHUTDOWN\n");
this.root_devices = null;
base.shutdown ();
}
public override bool name_lost () {
- print ("NAME_LOSTT\n");
this.root_devices = null;
this.release ();
@@ -274,8 +299,6 @@ public class Rygel.Application : GLib.Application {
}
}
-
-
public static int main(string[] args) {
Environment.set_application_name (_(BuildConfig.PACKAGE_NAME));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]