commit 7f784fd23597e146c035a51e4256be8a1d923824
Author: Oswald Buddenhagen <[email protected]>
Date:   Sat Nov 2 20:47:20 2013 +0100

    log maxuid bumping less aggressively
    
    we can bump the internal variable whereever convenient, but we cannot
    log it until we know that all messages were copied, as otherwise we
    could miss some new messages after an interruption. with the new
    approach, interruption would merely cause some additonal traffic.

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

diff --git a/src/sync.c b/src/sync.c
index d80c5da..47ed09e 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -1224,6 +1224,12 @@ box_loaded( int sts, void *aux )
                                                Fprintf( svars->jfp, "+ %d 
%d\n", srec->uid[M], srec->uid[S] );
                                                debug( "  -> pair(%d,%d) 
created\n", srec->uid[M], srec->uid[S] );
                                        }
+                                       if (svars->maxuid[1-t] < tmsg->uid) {
+                                               /* We do this here for 
simplicity. However, logging must be delayed until
+                                                * all messages were 
propagated, as skipped messages could otherwise be
+                                                * logged before the 
propagation of messages with lower UIDs completes. */
+                                               svars->maxuid[1-t] = tmsg->uid;
+                                       }
                                        if ((tmsg->flags & F_FLAGGED) || 
tmsg->size <= svars->chan->stores[t]->max_size) {
                                                if (tmsg->flags) {
                                                        srec->flags = 
tmsg->flags;
@@ -1502,10 +1508,6 @@ msg_copied_p2( sync_vars_t *svars, sync_rec_t *srec, int 
t, message_t *tmsg, int
        }
        if (!tmsg->srec) {
                tmsg->srec = srec;
-               if (svars->maxuid[1-t] < tmsg->uid) {
-                       svars->maxuid[1-t] = tmsg->uid;
-                       Fprintf( svars->jfp, "%c %d\n", ")("[t], tmsg->uid );
-               }
        }
 }
 
@@ -1519,6 +1521,8 @@ msgs_copied( sync_vars_t *svars, int t )
        if (!(svars->state[t] & ST_SENT_NEW) || svars->new_done[t] < 
svars->new_total[t])
                return;
 
+       Fprintf( svars->jfp, "%c %d\n", ")("[t], svars->maxuid[1-t] );
+
        if (svars->state[t] & ST_FIND_NEW) {
                debug( "finding just copied messages on %s\n", str_ms[t] );
                svars->drv[t]->find_new_msgs( svars->ctx[t], msgs_found_new, 
AUX );

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to