[rygel] core: Stop the waiting loop on timeout



commit 2e97c96f6b270f3635111a0c44bc60e1bbdb67a1
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Dec 13 19:28:22 2010 +0200

    core: Stop the waiting loop on timeout
    
    If wait for container update times-out, stop spinning the wait loop.

 src/rygel/rygel-item-creator.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-item-creator.vala b/src/rygel/rygel-item-creator.vala
index e8756e1..b742878 100644
--- a/src/rygel/rygel-item-creator.vala
+++ b/src/rygel/rygel-item-creator.vala
@@ -311,10 +311,12 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
                     this.wait_for_item.callback ();
                 });
 
-                var timeout = Timeout.add_seconds (5, () => {
+                uint timeout = 0;
+                timeout = Timeout.add_seconds (5, () => {
                     debug ("Timeout on waiting for 'updated' signal on '%s'.",
                            container.id);
                     this.wait_for_item.callback ();
+                    timeout = 0;
 
                     return false;
                 });
@@ -322,7 +324,12 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
                 yield;
 
                 container.disconnect (id);
-                Source.remove (timeout);
+
+                if (timeout != 0) {
+                    Source.remove (timeout);
+                } else {
+                    break;
+                }
             }
         }
         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]