commit a041766140e41d596e37b76f2ecdffeac4992808
parent 1eb88d4fea2f0b2e14ccaaada4c2c1f3acd707ae
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date: Sun, 26 Apr 2015 20:59:11 +0200
Merge branch 'isync_1_2_branch'
Diffstat:
4 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/src/driver.h b/src/driver.h
@@ -41,7 +41,6 @@ typedef struct store_conf {
const char *trash;
uint max_size; /* off_t is overkill */
char trash_remote_new, trash_only_new;
- char failed;
} store_conf_t;
/* For message->flags */
@@ -249,6 +248,9 @@ struct driver {
/* Get approximate amount of memory occupied by the driver. */
int (*memory_usage)( store_t *ctx );
+
+ /* Get the FAIL_* state of the driver. */
+ int (*fail_state)( store_conf_t *conf );
};
void free_generic_messages( message_t * );
diff --git a/src/drv_imap.c b/src/drv_imap.c
@@ -57,6 +57,7 @@ typedef struct imap_server_conf {
#ifdef HAVE_LIBSSL
char ssl_type;
#endif
+ char failed;
} imap_server_conf_t;
typedef struct imap_store_conf {
@@ -2166,7 +2167,7 @@ imap_open_store_bail( imap_store_t *ctx, int failed )
{
void (*cb)( store_t *srv, void *aux ) = ctx->callbacks.imap_open;
void *aux = ctx->callback_aux;
- ctx->gen.conf->failed = failed;
+ ((imap_store_conf_t *)ctx->gen.conf)->server->failed = failed;
imap_cancel_store( &ctx->gen );
cb( 0, aux );
}
@@ -2668,6 +2669,14 @@ imap_memory_usage( store_t *gctx )
return ctx->buffer_mem + ctx->conn.buffer_mem;
}
+/******************* imap_fail_state *******************/
+
+static int
+imap_fail_state( store_conf_t *gconf )
+{
+ return ((imap_store_conf_t *)gconf)->server->failed;
+}
+
/******************* imap_parse_store *******************/
imap_server_conf_t *servers, **serverapp = &servers;
@@ -2950,4 +2959,5 @@ struct driver imap_driver = {
imap_cancel_cmds,
imap_commit_cmds,
imap_memory_usage,
+ imap_fail_state,
};
diff --git a/src/drv_maildir.c b/src/drv_maildir.c
@@ -57,6 +57,7 @@ typedef struct maildir_store_conf {
int alt_map;
#endif /* USE_DB */
char info_delimiter;
+ char failed;
char *info_prefix, *info_stop; /* precalculated from info_delimiter */
} maildir_store_conf_t;
@@ -141,12 +142,12 @@ maildir_validate_path( store_conf_t *conf )
if (!conf->path) {
error( "Maildir error: store '%s' has no Path\n", conf->name );
- conf->failed = FAIL_FINAL;
+ ((maildir_store_conf_t *)conf)->failed = FAIL_FINAL;
return -1;
}
if (stat( conf->path, &st ) || !S_ISDIR(st.st_mode)) {
error( "Maildir error: cannot open store '%s'\n", conf->path );
- conf->failed = FAIL_FINAL;
+ ((maildir_store_conf_t *)conf)->failed = FAIL_FINAL;
return -1;
}
return 0;
@@ -432,7 +433,7 @@ maildir_validate( const char *box, int create, maildir_store_t *ctx )
return DRV_BOX_BAD;
if (make_box_dir( buf, bl )) {
sys_error( "Maildir error: cannot create mailbox '%s'", box );
- ctx->gen.conf->failed = FAIL_FINAL;
+ ((maildir_store_conf_t *)ctx->gen.conf)->failed = FAIL_FINAL;
maildir_invoke_bad_callback( &ctx->gen );
return DRV_CANCELED;
}
@@ -1631,6 +1632,12 @@ maildir_memory_usage( store_t *gctx ATTR_UNUSED )
}
static int
+maildir_fail_state( store_conf_t *gconf )
+{
+ return ((maildir_store_conf_t *)gconf)->failed;
+}
+
+static int
maildir_parse_store( conffile_t *cfg, store_conf_t **storep )
{
maildir_store_conf_t *store;
@@ -1698,4 +1705,5 @@ struct driver maildir_driver = {
maildir_cancel_cmds,
maildir_commit_cmds,
maildir_memory_usage,
+ maildir_fail_state,
};
diff --git a/src/main.c b/src/main.c
@@ -448,7 +448,7 @@ main( int argc, char **argv )
else if (!strcmp( opt, "-net" ))
op = VERBOSE | DEBUG_NET;
else if (!strcmp( opt, "-net-all" ))
- op = VERBOSE | DEBUG_NET_ALL;
+ op = VERBOSE | DEBUG_NET | DEBUG_NET_ALL;
else if (!strcmp( opt, "-sync" ))
op = VERBOSE | DEBUG_SYNC;
else
@@ -637,7 +637,7 @@ main( int argc, char **argv )
op |= DEBUG_NET | VERBOSE;
break;
case 'N':
- op |= DEBUG_NET_ALL | VERBOSE;
+ op |= DEBUG_NET | DEBUG_NET_ALL | VERBOSE;
break;
case 's':
op |= DEBUG_SYNC | VERBOSE;
@@ -757,8 +757,10 @@ sync_chans( main_vars_t *mvars, int ent )
info( "Channel %s\n", mvars->chan->name );
mvars->skip = mvars->cben = 0;
for (t = 0; t < 2; t++) {
- if (mvars->chan->stores[t]->failed != FAIL_TEMP) {
- info( "Skipping due to failed %s store %s.\n", str_ms[t], mvars->chan->stores[t]->name );
+ int st = mvars->chan->stores[t]->driver->fail_state( mvars->chan->stores[t] );
+ if (st != FAIL_TEMP) {
+ info( "Skipping due to %sfailed %s store %s.\n",
+ (st == FAIL_WAIT) ? "temporarily " : "", str_ms[t], mvars->chan->stores[t]->name );
mvars->skip = 1;
}
}