commit 9cb54888910a539b5ce4213550f2f5c493fccba1
Author:     Oswald Buddenhagen <o...@kde.org>
AuthorDate: Sat Mar 30 16:27:11 2013 +0100
Commit:     Oswald Buddenhagen <o...@users.sf.net>
CommitDate: Sat Mar 30 16:46:18 2013 +0100

    don't record newuid in the sync state
    
    this value is only ever used to find just pushed messages by TUID, so we
    can simply use the UIDNEXT value from before we started pushing - and of
    course, we need to record that in the journal. it makes no sense to log
    the new value after completing a search, as there won't be a next search
    before we push the next messages.

 src/run-tests.pl |    2 +-
 src/sync.c       |   13 ++++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/run-tests.pl b/src/run-tests.pl
index 25eae65..ab7bab8 100755
--- a/src/run-tests.pl
+++ b/src/run-tests.pl
@@ -508,7 +508,7 @@ sub ckstate($@)
                return 1;
        }
        chomp($l);
-       my $xl = "1:".shift(@T).":0 1:".shift(@T).":".shift(@T).":0";
+       my $xl = "1:".shift(@T)." 1:".shift(@T).":".shift(@T);
        if ($l ne $xl) {
                print STDERR "Sync state header mismatch: '$l' instead of 
'$xl'.\n";
                return 1;
diff --git a/src/sync.c b/src/sync.c
index c112beb..ed71801 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -725,8 +725,8 @@ box_selected( int sts, void *aux )
                        return;
                }
                if (sscanf( buf, "%63s %63s", buf1, buf2 ) != 2 ||
-                   sscanf( buf1, "%d:%d:%d", &svars->uidval[M], 
&svars->maxuid[M], &svars->newuid[M] ) < 2 ||
-                   sscanf( buf2, "%d:%d:%d:%d", &svars->uidval[S], 
&svars->smaxxuid, &svars->maxuid[S], &svars->newuid[S] ) < 3) {
+                   sscanf( buf1, "%d:%d", &svars->uidval[M], &svars->maxuid[M] 
) < 2 ||
+                   sscanf( buf2, "%d:%d:%d", &svars->uidval[S], 
&svars->smaxxuid, &svars->maxuid[S] ) < 3) {
                        error( "Error: invalid sync state header in %s\n", 
svars->dname );
                        goto jbail;
                }
@@ -1045,7 +1045,6 @@ box_loaded( int sts, void *aux )
                debug( "matching previously copied messages on %s\n", str_ms[t] 
);
                match_tuids( svars, t );
        }
-       Fprintf( svars->jfp, "%c %d\n", "{}"[t], svars->ctx[t]->uidnext );
 
        debug( "matching messages on %s against sync records\n", str_ms[t] );
        hashsz = bucketsForSize( svars->nsrecs * 3 );
@@ -1161,6 +1160,7 @@ box_loaded( int sts, void *aux )
        debug( "synchronizing new entries\n" );
        svars->osrecadd = svars->srecadd;
        for (t = 0; t < 2; t++) {
+               Fprintf( svars->jfp, "%c %d\n", "{}"[t], svars->ctx[t]->uidnext 
);
                for (tmsg = svars->ctx[1-t]->msgs; tmsg; tmsg = tmsg->next)
                        if (tmsg->srec ? tmsg->srec->uid[t] < 0 && 
(tmsg->srec->uid[t] == -1 ? (svars->chan->ops[t] & OP_RENEW) : 
(svars->chan->ops[t] & OP_NEW)) : (svars->chan->ops[t] & OP_NEW)) {
                                debug( "new message %d on %s\n", tmsg->uid, 
str_ms[1-t] );
@@ -1461,7 +1461,6 @@ msgs_found_new( int sts, void *aux )
 static void
 msgs_new_done( sync_vars_t *svars, int t )
 {
-       Fprintf( svars->jfp, "%c %d\n", "{}"[t], svars->ctx[t]->uidnext );
        svars->state[t] |= ST_FOUND_NEW;
        sync_close( svars, t );
 }
@@ -1695,9 +1694,9 @@ box_closed_p2( sync_vars_t *svars, int t )
                }
        }
 
-       Fprintf( svars->nfp, "%d:%d:%d %d:%d:%d:%d\n",
-                svars->uidval[M], svars->maxuid[M], svars->ctx[M]->uidnext,
-                svars->uidval[S], svars->smaxxuid, svars->maxuid[S], 
svars->ctx[S]->uidnext );
+       Fprintf( svars->nfp, "%d:%d %d:%d:%d\n",
+                svars->uidval[M], svars->maxuid[M],
+                svars->uidval[S], svars->smaxxuid, svars->maxuid[S] );
        for (srec = svars->srecs; srec; srec = srec->next) {
                if (srec->status & S_DEAD)
                        continue;

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to