[asterisk-commits] tilghman: branch 1.4 r160558 - /branches/1.4/pbx/pbx_spool.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 3 11:34:34 CST 2008


Author: tilghman
Date: Wed Dec  3 11:34:34 2008
New Revision: 160558

URL: http://svn.digium.com/view/asterisk?view=rev&rev=160558
Log:
If an entry is added to the directory during a scan when another entry expires,
then that new entry will not be processed promptly, but must wait for either a
future entry to start or a current entry's retry to occur.  If no other entries
exist in the directory (other than the new entries) when a bunch expire, then
the new entries must wait until another new entry is added to be processed.
This was a rather weird race condition, really.  Fixes AST-147.

Modified:
    branches/1.4/pbx/pbx_spool.c

Modified: branches/1.4/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/pbx/pbx_spool.c?view=diff&rev=160558&r1=160557&r2=160558
==============================================================================
--- branches/1.4/pbx/pbx_spool.c (original)
+++ branches/1.4/pbx/pbx_spool.c Wed Dec  3 11:34:34 2008
@@ -462,7 +462,7 @@
 #if 0
 				printf("atime: %ld, mtime: %ld, ctime: %ld\n", st.st_atime, st.st_mtime, st.st_ctime);
 				printf("Ooh, something changed / timeout\n");
-#endif				
+#endif
 				next = 0;
 				last = st.st_mtime;
 				dir = opendir(qdir);
@@ -478,8 +478,12 @@
 										if (!next || (res < next)) {
 											next = res;
 										}
-									} else if (res)
+									} else if (res) {
 										ast_log(LOG_WARNING, "Failed to scan service '%s'\n", fn);
+									} else if (!next) {
+										/* Expired entry: must recheck on the next go-around */
+										next = st.st_mtime;
+									}
 								} else {
 									/* Update "next" update if necessary */
 									if (!next || (st.st_mtime < next))




More information about the asterisk-commits mailing list