diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-03 17:34:34 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-12-03 17:34:34 +0000 |
commit | d790ede395881201d8f3d55975c24e9acde8c2f6 (patch) | |
tree | 87fbd5626c6977d19a0676af2424981bdd25a432 /pbx/pbx_spool.c | |
parent | 82f89b99ec05a18f69c2989ff090f36f05400df4 (diff) |
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.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@160558 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx/pbx_spool.c')
-rw-r--r-- | pbx/pbx_spool.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c index ba73e0d44..8c8880d72 100644 --- a/pbx/pbx_spool.c +++ b/pbx/pbx_spool.c @@ -462,7 +462,7 @@ static void *scan_thread(void *unused) #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 @@ static void *scan_thread(void *unused) 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)) |