Patch: stream cache returns original stream if it cannot allocate space in cache for the new stream



	Hi,

	This patch makes the stream cache work as it's expected in this case:
if we have a too big stream, and this doesn't fit in the stream cache,
then we return the original stream so that it's properly provided to
user.

Changelog entry:
	* libtinymail/tny-fs-stream-cache.c
	(tny_fs_stream_cache_get_stream): return original stream
	if we cannot put the stream in cache.



-- 
José Dapena Paz <jdapena igalia com>
Igalia
diff --git a/ChangeLog b/ChangeLog
index 7c56e12..9e6a3a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-17  Jose Dapena Paz  <jdapena igalia com>
+
+	* libtinymail/tny-fs-stream-cache.c
+	(tny_fs_stream_cache_get_stream): return original stream
+	if we cannot put the stream in cache.
+
 2010-02-16  Jose Dapena Paz  <jdapena igalia com>
 
 	* libtinymailui-gtk/tny-gtk-header-list-model.c: trivial fix
diff --git a/libtinymail/tny-fs-stream-cache.c b/libtinymail/tny-fs-stream-cache.c
index f983368..475c803 100644
--- a/libtinymail/tny-fs-stream-cache.c
+++ b/libtinymail/tny-fs-stream-cache.c
@@ -193,6 +193,8 @@ tny_fs_stream_cache_get_stream (TnyStreamCache *self, const gchar *id,
 			g_hash_table_insert (priv->cached_files, g_strdup (id), cached_file);
 			g_static_mutex_unlock (priv->cache_lock);
 			result = tny_cached_file_get_stream (cached_file);
+		} else {
+			result = input_stream;
 		}
 	}
 


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