[rygel] core: Add timeouts to container update waiting code



commit 304769804add1272d108d4a9a14ed03b035f470b
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Dec 13 19:03:23 2010 +0200

    core: Add timeouts to container update waiting code

 src/rygel/rygel-http-post.vala    |    8 ++++++++
 src/rygel/rygel-item-creator.vala |    9 +++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-http-post.vala b/src/rygel/rygel-http-post.vala
index 9098a7a..41cb366 100644
--- a/src/rygel/rygel-http-post.vala
+++ b/src/rygel/rygel-http-post.vala
@@ -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,
diff --git a/src/rygel/rygel-item-creator.vala b/src/rygel/rygel-item-creator.vala
index bc6d927..e8756e1 100644
--- a/src/rygel/rygel-item-creator.vala
+++ b/src/rygel/rygel-item-creator.vala
@@ -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'",



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