summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pamment <apamment@yandex.com>2019-02-09 14:35:05 +1000
committerAndrew Pamment <apamment@yandex.com>2019-02-09 14:35:05 +1000
commita4da8d8980b7c787cd8ce7b56f4ed8dad896edd1 (patch)
treeaceb03ee2bb6dda672c8cd5489e9e372e3200502
parentf58852950fcce8e3f99281995982fe7fbdf22905 (diff)
Make jam msglib a little more fault tolerant
-rw-r--r--src/msglib/msglib_jam.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/msglib/msglib_jam.c b/src/msglib/msglib_jam.c
index 2dac76e..f462932 100644
--- a/src/msglib/msglib_jam.c
+++ b/src/msglib/msglib_jam.c
@@ -45,7 +45,7 @@ struct msg_headers *jam_read_message_headers(int msgconf, int msgarea, struct us
int z;
int j;
int k;
-
+ int failed = 0;
struct fido_addr *dest;
struct msg_headers *msghs = NULL;
struct mail_conference *mc = ptr_vector_get(&conf.mail_conferences, msgconf);
@@ -75,7 +75,11 @@ struct msg_headers *jam_read_message_headers(int msgconf, int msgarea, struct us
memset(&jmh, 0, sizeof(s_JamMsgHeader));
z = JAM_ReadMsgHeader(jb, i, &jmh, &jsp);
if (z != 0) {
- dolog("Failed to read msg header: %d Erro %d", z, JAM_Errno(jb));
+ failed++;
+ k++;
+ if (failed == 5000) {
+ break;
+ }
continue;
}
@@ -168,6 +172,11 @@ struct msg_headers *jam_read_message_headers(int msgconf, int msgarea, struct us
JAM_CloseMB(jb);
free(jb);
+
+ if (failed > 0) {
+ dolog("Failed to read %d messages, possible corrupt msg base (%s -> %s)?", failed, mc->name, area->name);
+ }
+
return msghs;
}
@@ -468,4 +477,4 @@ struct msg_t *jam_message_header(s_JamBase *jb, int id) {
}
return jamm;
-} \ No newline at end of file
+}