[rygel] core: ContentDirectory keeps a list of active imports



commit 175ec1201d7974db9cb7ad54bbab949a3571834c
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Feb 18 16:54:58 2010 +0200

    core: ContentDirectory keeps a list of active imports

 src/rygel/rygel-content-directory.vala |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-content-directory.vala b/src/rygel/rygel-content-directory.vala
index 8718c8d..902bb97 100644
--- a/src/rygel/rygel-content-directory.vala
+++ b/src/rygel/rygel-content-directory.vala
@@ -57,6 +57,8 @@ public class Rygel.ContentDirectory: Service {
     public MediaContainer root_container;
     private ArrayList<MediaContainer> updated_containers;
 
+    private ArrayList<ImportResource> active_imports;
+
     private bool clear_updated_containers;
     private uint update_notify_id;
 
@@ -84,6 +86,7 @@ public class Rygel.ContentDirectory: Service {
         }
 
         this.updated_containers =  new ArrayList<MediaContainer> ();
+        this.active_imports = new ArrayList<ImportResource> ();
 
         this.root_container.container_updated += on_container_updated;
 
@@ -161,9 +164,22 @@ public class Rygel.ContentDirectory: Service {
                                              owned ServiceAction action) {
         var import = new ImportResource (this, action);
 
+        import.completed += this.on_import_completed;
+        this.active_imports.add (import);
+
         import.run.begin ();
     }
 
+    private void on_import_completed (ImportResource import) {
+        // According to CDS specs (v3 section 2.4.17), we must not immediately
+        // remove the import from out memory
+        Timeout.add_seconds (30, () => {
+                this.active_imports.remove (import);
+
+                return false;
+        });
+    }
+
     /* GetSystemUpdateID action implementation */
     private void get_system_update_id_cb (ContentDirectory    content_dir,
                                           owned ServiceAction action) {



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