[rygel/rygel-0-30] core: Always delay reload of config file



commit 56689580a0ed7954b18fa0d4acde832a657b6923
Author: Jens Georg <mail jensge org>
Date:   Sun Apr 10 17:06:04 2016 +0200

    core: Always delay reload of config file
    
    It seems that if we reload the config files too early even after CHANGES_DONE
    hint, we still read a corrupt file.
    
    So change the code to always delay the read.
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764829

 src/rygel/rygel-user-config.vala |   46 ++++++++++++-------------------------
 1 files changed, 15 insertions(+), 31 deletions(-)
---
diff --git a/src/rygel/rygel-user-config.vala b/src/rygel/rygel-user-config.vala
index 7998c1f..5fd232c 100644
--- a/src/rygel/rygel-user-config.vala
+++ b/src/rygel/rygel-user-config.vala
@@ -748,46 +748,30 @@ public class Rygel.UserConfig : GLib.Object, Configuration {
                                            File file,
                                            File? other_file,
                                            FileMonitorEvent event_type) {
-        if (event_type == FileMonitorEvent.CHANGES_DONE_HINT) {
-            if (this.system_config_timer_id != 0) {
-                Source.remove (this.system_config_timer_id);
-                this.system_config_timer_id = 0;
-            }
+        if (this.system_config_timer_id != 0) {
+            Source.remove (this.system_config_timer_id);
+        }
+        this.system_config_timer_id = Timeout.add (500, () => {
+            this.system_config_timer_id = 0;
             this.reload_compare_and_notify_system (file);
-        } else {
-            if (this.system_config_timer_id != 0) {
-                Source.remove (this.system_config_timer_id);
-            }
-            this.system_config_timer_id = Timeout.add (500, () => {
-                this.system_config_timer_id = 0;
-                this.reload_compare_and_notify_system (file);
 
-                return false;
-            });
-        }
+            return false;
+        });
     }
 
     private void on_local_config_changed (FileMonitor monitor,
                                           File file,
                                           File? other_file,
                                           FileMonitorEvent event_type) {
-        if (event_type == FileMonitorEvent.CHANGES_DONE_HINT) {
-            if (this.local_config_timer_id != 0) {
-                Source.remove (this.local_config_timer_id);
-                this.local_config_timer_id = 0;
-            }
-            this.reload_compare_and_notify_local (file);
-        } else {
-            if (this.local_config_timer_id != 0) {
-                Source.remove (this.local_config_timer_id);
-            }
+        if (this.local_config_timer_id != 0) {
+            Source.remove (this.local_config_timer_id);
+        }
 
-            this.local_config_timer_id = Timeout.add (500, () => {
-                this.local_config_timer_id = 0;
-                this.reload_compare_and_notify_local (file);
+        this.local_config_timer_id = Timeout.add (500, () => {
+            this.local_config_timer_id = 0;
+            this.reload_compare_and_notify_local (file);
 
-                return false;
-            });
-        }
+            return false;
+        });
     }
 }


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