[asterisk-commits] media cache: Mark cache entry stale if cache file is removed (asterisk[14])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 1 04:47:38 CST 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5107 )

Change subject: media_cache: Mark cache entry stale if cache file is removed
......................................................................


media_cache: Mark cache entry stale if cache file is removed

In the event that a cache file is removed out from under us, we should
treat the cache entry as stale and force a refresh.

ASTERISK-26774 #close
Reported by: Igor Gamayunov

Change-Id: I3b1bd0c999d59d18664ef73a29823bc5b431dc52
---
M main/media_cache.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/main/media_cache.c b/main/media_cache.c
index 958a05b..4d1cf54 100644
--- a/main/media_cache.c
+++ b/main/media_cache.c
@@ -226,7 +226,8 @@
 	 */
 	bucket_file = ao2_find(media_cache, uri, OBJ_SEARCH_KEY | OBJ_NOLOCK);
 	if (bucket_file) {
-		if (!ast_bucket_file_is_stale(bucket_file)) {
+		if (!ast_bucket_file_is_stale(bucket_file)
+			&& !access(bucket_file->path, R_OK)) {
 			ast_copy_string(file_path, bucket_file->path, len);
 			if ((ext = strrchr(file_path, '.'))) {
 				*ext = '\0';

-- 
To view, visit https://gerrit.asterisk.org/5107
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3b1bd0c999d59d18664ef73a29823bc5b431dc52
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-commits mailing list