commit f1809ddd2b32d01d8fd7161040768ab4377285ce
Author: Oswald Buddenhagen <[email protected]>
Date:   Sat Jan 3 23:16:20 2015 +0100

    open the mailboxes after loading the sync state
    
    this allows us to react differently to a box'es absence depending on the
    state. hypothetically, so far.

 src/sync.c |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index 916a461..889af28 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -924,6 +924,7 @@ load_state( sync_vars_t *svars )
 }
 
 static void box_opened( int sts, void *aux );
+static void load_box( sync_vars_t *svars, int t, int minwuid, int *mexcs, int 
nmexcs );
 
 void
 sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan,
@@ -968,48 +969,48 @@ sync_boxes( store_t *ctx[], const char *names[], 
channel_conf_t *chan,
                        return;
                }
        }
+
+       if (!prepare_state( svars )) {
+               svars->ret = SYNC_FAIL;
+               sync_bail2( svars );
+               return;
+       }
+       if (!load_state( svars )) {
+               svars->ret = SYNC_FAIL;
+               sync_bail( svars );
+               return;
+       }
+
        sync_ref( svars );
-       for (t = 0; t < 2; t++) {
+       for (t = 0; ; t++) {
                info( "Opening %s box %s...\n", str_ms[t], svars->orig_name[t] 
);
                svars->drv[t]->open_box( ctx[t], (chan->ops[t] & OP_CREATE) != 
0, box_opened, AUX );
-               if (check_cancel( svars ))
+               if (t || check_cancel( svars ))
                        break;
        }
        sync_deref( svars );
 }
 
-static void load_box( sync_vars_t *svars, int t, int minwuid, int *mexcs, int 
nmexcs );
-
 static void
 box_opened( int sts, void *aux )
 {
        DECL_SVARS;
-       sync_rec_t *srec;
        store_t *ctx[2];
        channel_conf_t *chan;
+       sync_rec_t *srec;
        int opts[2], fails;
        int *mexcs, nmexcs, rmexcs, minwuid;
 
        if (check_ret( sts, aux ))
                return;
        INIT_SVARS(aux);
-       ctx[0] = svars->ctx[0];
-       ctx[1] = svars->ctx[1];
-       chan = svars->chan;
+
        svars->state[t] |= ST_SELECTED;
        if (!(svars->state[1-t] & ST_SELECTED))
                return;
-
-       if (!prepare_state( svars )) {
-               svars->ret = SYNC_FAIL;
-               sync_bail2( svars );
-               return;
-       }
-       if (!load_state( svars )) {
-               svars->ret = SYNC_FAIL;
-               sync_bail( svars );
-               return;
-       }
+       ctx[0] = svars->ctx[0];
+       ctx[1] = svars->ctx[1];
+       chan = svars->chan;
 
        fails = 0;
        for (t = 0; t < 2; t++)

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to