commit 702ccb993dee55486ca5712f0b2b9808b587b627
Author: Oswald Buddenhagen <o...@kde.org>
Date:   Sun Mar 27 16:58:23 2011 +0200

    make IMAP pipeline depth configurable
    
    currently, this affects only "clustered" message listings and
    flag stores.

 src/drv_imap.c |   11 +++++++++--
 src/mbsync.1   |    9 +++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index e81a7b3..0342a0b 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -40,6 +40,7 @@ typedef struct imap_server_conf {
        server_conf_t sconf;
        char *user;
        char *pass;
+       int max_in_progress;
 #ifdef HAVE_LIBSSL
        unsigned require_ssl:1;
        unsigned require_cram:1;
@@ -67,7 +68,6 @@ typedef struct _list {
 } list_t;
 
 struct imap_cmd;
-#define max_in_progress 50 /* make this configurable? */
 
 typedef struct imap_store {
        store_t gen;
@@ -392,7 +392,7 @@ drain_imap_replies( imap_store_t *ctx )
 static int
 process_imap_replies( imap_store_t *ctx )
 {
-       while (ctx->num_in_progress > max_in_progress ||
+       while (ctx->num_in_progress > ((imap_store_conf_t 
*)ctx->gen.conf)->server->max_in_progress ||
               socket_pending( &ctx->conn ))
                if (get_cmd_result( ctx, 0 ) == RESP_CANCEL)
                        return RESP_CANCEL;
@@ -1719,6 +1719,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep, 
int *err )
        server->require_ssl = 1;
        server->sconf.use_tlsv1 = 1;
 #endif
+       server->max_in_progress = 50;
 
        while (getcline( cfg ) && cfg->cmd) {
                if (!strcasecmp( "Host", cfg->cmd )) {
@@ -1745,6 +1746,12 @@ imap_parse_store( conffile_t *cfg, store_conf_t 
**storep, int *err )
                        server->pass = nfstrdup( cfg->val );
                else if (!strcasecmp( "Port", cfg->cmd ))
                        server->sconf.port = parse_int( cfg );
+               else if (!strcasecmp( "PipelineDepth", cfg->cmd )) {
+                       if ((server->max_in_progress = parse_int( cfg )) < 1) {
+                               error( "%s:%d: PipelineDepth must be at least 
1\n", cfg->file, cfg->line );
+                               *err = 1;
+                       }
+               }
 #ifdef HAVE_LIBSSL
                else if (!strcasecmp( "CertificateFile", cfg->cmd )) {
                        server->sconf.cert_file = expand_strdup( cfg->val );
diff --git a/src/mbsync.1 b/src/mbsync.1
index 04c458b..4f47668 100644
--- a/src/mbsync.1
+++ b/src/mbsync.1
@@ -277,6 +277,15 @@ Use SSLv3 for communication with the IMAP server over SSL?
 Use TLSv1 for communication with the IMAP server over SSL?
 (Default: \fIyes\fR)
 ..
+.TP
+\fBPipelineDepth\fR \fIdepth\fR
+Maximum number of IMAP commands which can be simultaneously in flight.
+Setting this to \fI1\fR disables pipelining.
+Setting it to a too big value may deadlock isync.
+Currently, this affects only a few commands.
+This is mostly a debugging only option.
+(Default: \fI50\fR)
+..
 .SS IMAP Stores
 The reference point for relative \fBPath\fRs is whatever the server likes it
 to be; probably the user's $HOME or $HOME/Mail on that server. The location

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to