diff options
author | Alexander Larsson <alexl@redhat.com> | 2008-03-26 15:11:27 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2008-03-26 15:11:27 +0000 |
commit | 7389e23bbb91673712c2d929140748c027bb107d (patch) | |
tree | f1eb916ab80ab519ffb58a37755e8fe5cb9a20da | |
parent | bab7e6cab5718aab3a96417ca6f06b82b91d0eea (diff) | |
download | gvfs-7389e23bbb91673712c2d929140748c027bb107d.tar.gz |
Avoid hanging forever and not sending any async messages. This could
2008-03-26 Alexander Larsson <alexl@redhat.com>
* client/gdaemonfileenumerator.c:
(g_daemon_file_enumerator_next_file):
Avoid hanging forever and not sending any async messages.
This could happen if we raced and missed the done check.
svn path=/trunk/; revision=1682
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | client/gdaemonfileenumerator.c | 12 |
2 files changed, 16 insertions, 3 deletions
@@ -1,5 +1,12 @@ 2008-03-26 Alexander Larsson <alexl@redhat.com> + * client/gdaemonfileenumerator.c: + (g_daemon_file_enumerator_next_file): + Avoid hanging forever and not sending any async messages. + This could happen if we raced and missed the done check. + +2008-03-26 Alexander Larsson <alexl@redhat.com> + * daemon/gvfsmonitor.c: Send replies to subscribe and unsubscribe messages. diff --git a/client/gdaemonfileenumerator.c b/client/gdaemonfileenumerator.c index 1fc8209e..3df80904 100644 --- a/client/gdaemonfileenumerator.c +++ b/client/gdaemonfileenumerator.c @@ -196,10 +196,12 @@ g_daemon_file_enumerator_next_file (GFileEnumerator *enumerator, GDaemonFileEnumerator *daemon = G_DAEMON_FILE_ENUMERATOR (enumerator); GFileInfo *info; gboolean done; + int count; info = NULL; done = FALSE; - while (1) + count = 0; + while (count < G_VFS_DBUS_TIMEOUT_MSECS / 100) { G_LOCK (infos); if (daemon->infos) @@ -219,8 +221,12 @@ g_daemon_file_enumerator_next_file (GFileEnumerator *enumerator, if (done) break; - - if (!dbus_connection_read_write_dispatch (daemon->sync_connection, -1)) + + /* We sleep only 100 msecs here, not the full time because we might have + * raced with the filter func being called after unlocking + * and setting done or ->infos. So, we want to check it again reasonaby soon. + */ + if (!dbus_connection_read_write_dispatch (daemon->sync_connection, 100)) break; } |