heed M_DEAD more thoroughly

this doesn't really fix anything under current conditions, as so far
only Maildir driver functions that modify known messages can cause
concurrent expunges to be detected, and we don't call any of these
before the so far unchecked loops.
This commit is contained in:
Oswald Buddenhagen 2022-01-03 16:53:43 +01:00
parent 4e25fd59c1
commit fa8186c8d4
2 changed files with 14 additions and 2 deletions

View File

@ -272,16 +272,22 @@ static @type@proxy_@name@( store_t *gctx@decl_args@, void (*cb)( @decl_cb_args@v
//# DEFINE load_box_print_fmt_cb_args , total=%d, recent=%d
//# DEFINE load_box_print_pass_cb_args , total_msgs, recent_msgs
//# DEFINE load_box_print_cb_args
for (message_t *msg = msgs; msg; msg = msg->next)
for (message_t *msg = msgs; msg; msg = msg->next) {
if (msg->status & M_DEAD)
continue;
debug( " uid=%-5u flags=%-4s size=%-6u tuid=%." stringify(TUIDL) "s\n",
msg->uid, (msg->status & M_FLAGS) ? fmt_flags( msg->flags ).str : "?", msg->size, *msg->tuid ? msg->tuid : "?" );
}
//# END
//# UNDEFINE find_new_msgs_print_fmt_cb_args
//# UNDEFINE find_new_msgs_print_pass_cb_args
//# DEFINE find_new_msgs_print_cb_args
for (message_t *msg = msgs; msg; msg = msg->next)
for (message_t *msg = msgs; msg; msg = msg->next) {
if (msg->status & M_DEAD)
continue;
debug( " uid=%-5u tuid=%." stringify(TUIDL) "s\n", msg->uid, msg->tuid );
}
//# END
//# DEFINE fetch_msg_print_fmt_args , uid=%u, want_flags=%s, want_date=%s

View File

@ -1075,6 +1075,8 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
for (t = 0; t < 2; t++) {
debug( "synchronizing new messages on %s\n", str_fn[t^1] );
for (tmsg = svars->msgs[t^1]; tmsg; tmsg = tmsg->next) {
if (tmsg->status & M_DEAD)
continue;
srec = tmsg->srec;
if (srec) {
if (srec->status & S_SKIPPED) {
@ -1418,6 +1420,8 @@ msgs_copied( sync_vars_t *svars, int t )
if (!(svars->state[t] & ST_SENT_NEW)) {
for (tmsg = svars->new_msgs[t]; tmsg; tmsg = tmsg->next) {
if (tmsg->status & M_DEAD)
continue;
if ((srec = tmsg->srec) && (srec->status & S_PENDING)) {
if (svars->drv[t]->get_memory_usage( svars->ctx[t] ) >= BufferLimit) {
svars->new_msgs[t] = tmsg;
@ -1568,6 +1572,8 @@ msgs_flags_set( sync_vars_t *svars, int t )
goto skip;
}
for (tmsg = svars->msgs[t]; tmsg; tmsg = tmsg->next) {
if (tmsg->status & M_DEAD)
continue;
if (!(tmsg->flags & F_DELETED)) {
//debug( " message %u is not deleted\n", tmsg->uid ); // Too noisy
continue;