[rygel] core: Signal transfer completed immediately



commit 48eed9aba53d6dbbc152e7f3bbd3bc11ac95d1fb
Author: Jens Georg <mail jensge org>
Date:   Tue May 31 11:59:56 2011 +0200

    core: Signal transfer completed immediately
    
    The end of the transfer operation must be signalled immediately. Also
    the TransferID of a finished transfer must not be in the TransferID
    properties anymore, but it still needs to be queriable for at least 30
    seconds after the transfer.
    
    Partially fixes UPnP CTT AV-CD:1-12.1.

 src/rygel/rygel-content-directory.vala |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/src/rygel/rygel-content-directory.vala b/src/rygel/rygel-content-directory.vala
index 5076878..8b6d01e 100644
--- a/src/rygel/rygel-content-directory.vala
+++ b/src/rygel/rygel-content-directory.vala
@@ -58,6 +58,7 @@ internal class Rygel.ContentDirectory: Service {
     private ArrayList<MediaContainer> updated_containers;
 
     private ArrayList<ImportResource> active_imports;
+    private ArrayList<ImportResource> finished_imports;
 
     private bool clear_updated_containers;
     private uint update_notify_id;
@@ -76,6 +77,7 @@ internal class Rygel.ContentDirectory: Service {
 
         this.updated_containers =  new ArrayList<MediaContainer> ();
         this.active_imports = new ArrayList<ImportResource> ();
+        this.finished_imports = new ArrayList<ImportResource> ();
 
         this.root_container.container_updated.connect (on_container_updated);
 
@@ -376,14 +378,18 @@ internal class Rygel.ContentDirectory: Service {
     private void on_import_completed (StateMachine machine) {
         var import = machine as ImportResource;
 
+        this.finished_imports.add (import);
+        this.active_imports.remove (import);
+
+        // signalize end of transfer
+        this.notify ("TransferIDs",
+                        typeof (string),
+                        this.create_transfer_ids ());
+
         // 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);
-
-                this.notify ("TransferIDs",
-                                typeof (string),
-                                this.create_transfer_ids ());
+                this.finished_imports.remove (import);
 
                 return false;
         });
@@ -405,6 +411,14 @@ internal class Rygel.ContentDirectory: Service {
             }
         }
 
+        foreach (var import in this.finished_imports) {
+            if (import.transfer_id == transfer_id) {
+                ret = import;
+
+                break;
+            }
+        }
+
         return ret;
     }
 }



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