core: Add timeouts to container update waiting code
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 13 Dec 2010 17:03:23 +0000 (19:03 +0200)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 13 Dec 2010 17:18:55 +0000 (19:18 +0200)
src/rygel/rygel-http-post.vala
src/rygel/rygel-item-creator.vala

index 9098a7a..41cb366 100644 (file)
@@ -94,6 +94,14 @@ internal class Rygel.HTTPPost : HTTPRequest {
             main_loop.quit ();
         });
 
+        Timeout.add_seconds (5, () => {
+            debug ("Timeout while waiting for 'updated' signal on '%s'.",
+                   this.item.parent.id);
+            main_loop.quit ();
+
+            return false;
+        });
+
         debug ("Waiting for update signal from container '%s' after pushing" +
                " content to its child item '%s'..",
                this.item.parent.id,
index bc6d927..e8756e1 100644 (file)
@@ -311,9 +311,18 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
                     this.wait_for_item.callback ();
                 });
 
+                var timeout = Timeout.add_seconds (5, () => {
+                    debug ("Timeout on waiting for 'updated' signal on '%s'.",
+                           container.id);
+                    this.wait_for_item.callback ();
+
+                    return false;
+                });
+
                 yield;
 
                 container.disconnect (id);
+                Source.remove (timeout);
             }
         }
         debug ("Finished waiting for new item to appear under container '%s'",