gvfs r1682 - in trunk: . client



Author: alexl
Date: Wed Mar 26 15:11:27 2008
New Revision: 1682
URL: http://svn.gnome.org/viewvc/gvfs?rev=1682&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/client/gdaemonfileenumerator.c

Modified: trunk/client/gdaemonfileenumerator.c
==============================================================================
--- trunk/client/gdaemonfileenumerator.c	(original)
+++ trunk/client/gdaemonfileenumerator.c	Wed Mar 26 15:11:27 2008
@@ -196,10 +196,12 @@
   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 @@
       
       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;
     }
 



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