commit fa8186c8d41aadb1b33a940e623d549b88745b9b
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Mon Jan 3 16:53:43 2022 +0100

    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.

 src/drv_proxy.c | 10 ++++++++--
 src/sync.c      |  6 ++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/drv_proxy.c b/src/drv_proxy.c
index cd0d5aa5..0713cd7c 100644
--- a/src/drv_proxy.c
+++ b/src/drv_proxy.c
@@ -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
diff --git a/src/sync.c b/src/sync.c
index 845a8834..ba7e12ba 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -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;


_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to