diff src/lib-storage/index/index-search.c @ 7241:a6c066f50877 HEAD

Added mail_set_cache_corrupted() to rebuild the cache file and force recalculating the given field.
author Timo Sirainen <tss@iki.fi>
date Thu, 14 Feb 2008 22:34:39 +0200
parents e6693a0ec8e1
children 8cfa61f98e32
line wrap: on
line diff
--- a/src/lib-storage/index/index-search.c	Thu Feb 14 21:48:18 2008 +0200
+++ b/src/lib-storage/index/index-search.c	Thu Feb 14 22:34:39 2008 +0200
@@ -478,18 +478,14 @@
 
 	i_stream_seek(ctx->input, 0);
 	ret = message_search_msg(msg_search_ctx, ctx->input, ctx->part);
-	if (ret < 0) {
-		mail_cache_set_corrupted(ctx->index_ctx->ibox->cache,
-			"Broken message structure for mail UID %u",
-			ctx->index_ctx->mail->uid);
-
-		/* get the body parts, and try again */
-		ctx->index_ctx->imail->data.parts = NULL;
+	if (ret < 0 && ctx->input->stream_errno == 0) {
+		/* try again without cached parts */
+		mail_set_cache_corrupted(ctx->index_ctx->mail,
+					 MAIL_FETCH_MESSAGE_PARTS);
 
 		i_stream_seek(ctx->input, 0);
 		ret = message_search_msg(msg_search_ctx, ctx->input, NULL);
-		if (ret < 0)
-			i_panic("Couldn't fix broken body structure");
+		i_assert(ret >= 0 || ctx->input->stream_errno != 0);
 	}
 
 	ARG_SET_RESULT(arg, ret > 0);