commit 34993fbca6856667d78857ebaa60beacffa73a15
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Thu Mar 30 20:04:02 2017 +0200

    fix sync resumption with aborted entries
    
    we need a separate log entry type which does proper mmaxxuid tracking.
    
    while moving code around, this also removes a redundant debug statement.
    
    amends b1842617.

 src/sync.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index 048b4a0..0a8cea6 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -828,7 +828,7 @@ load_state( sync_vars_t *svars )
                                      (t3 = 0, (sscanf( buf + 2, "%d %d %n", 
&t1, &t2, &t3 ) < 2) || !t3 || (t - t3 != TUIDL + 2)) :
                                      c == 'S' || c == '!' ?
                                        (sscanf( buf + 2, "%d", &t1 ) != 1) :
-                                       c == 'F' || c == 'T' || c == '+' || c 
== '&' || c == '-' || c == '|' || c == '/' || c == '\\' ?
+                                       c == 'F' || c == 'T' || c == '+' || c 
== '&' || c == '-' || c == '=' || c == '|' || c == '/' || c == '\\' ?
                                          (sscanf( buf + 2, "%d %d", &t1, &t2 ) 
!= 2) :
                                          (sscanf( buf + 2, "%d %d %d", &t1, 
&t2, &t3 ) != 3))
                                {
@@ -879,6 +879,11 @@ load_state( sync_vars_t *svars )
                                                debug( "killed\n" );
                                                srec->status = S_DEAD;
                                                break;
+                                       case '=':
+                                               debug( "aborted\n" );
+                                               svars->mmaxxuid = srec->uid[M];
+                                               srec->status = S_DEAD;
+                                               break;
                                        case '#':
                                                memcpy( srec->tuid, buf + t3 + 
2, TUIDL );
                                                debug( "TUID now %." 
stringify(TUIDL) "s\n", srec->tuid );
@@ -1698,8 +1703,6 @@ box_loaded( int sts, void *aux )
                                        } else if (todel > 0) {
                                                /* The message is excess. */
                                                srec->status |= S_NEXPIRE;
-                                               debug( "  new pair(%d,%d) 
expired\n", srec->uid[M], srec->uid[S] );
-                                               svars->mmaxxuid = srec->uid[M];
                                                todel--;
                                        }
                                }
@@ -1738,8 +1741,9 @@ box_loaded( int sts, void *aux )
                                }
                        } else {
                                if (srec->status & S_NEXPIRE) {
-                                       jFprintf( svars, "- %d %d\n", 
srec->uid[M], srec->uid[S] );
+                                       jFprintf( svars, "= %d %d\n", 
srec->uid[M], srec->uid[S] );
                                        debug( "  pair(%d,%d): 1 (abort)\n", 
srec->uid[M], srec->uid[S] );
+                                       svars->mmaxxuid = srec->uid[M];
                                        srec->msg[M]->srec = 0;
                                        srec->status = S_DEAD;
                                }

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to