commit a025359c8a08fbe07294d732e7efc8b0f3d55cc6
Author: Oswald Buddenhagen <o...@kde.org>
Date:   Sun Mar 6 22:30:44 2011 +0100

    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 5cefd19..24c243a 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;
 #if 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;
@@ -374,7 +374,7 @@ drain_imap_replies( imap_store_t *ctx )
 static void
 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 )) {
                get_cmd_result( ctx, 0 );
                if (ctx->store_canceled)
@@ -1736,6 +1736,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 )) {
@@ -1762,6 +1763,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" );
+                               *err = 1;
+                       }
+               }
 #if 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

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to