[geary/mjog/server-quirks: 21/24] Geary.Endpoint: Move max batch size quirk config to quirks object



commit 69304f822824d2def7719b4272191de18d556996
Author: Michael Gratton <mike vee net>
Date:   Sat May 2 15:11:36 2020 +1000

    Geary.Endpoint: Move max batch size quirk config to quirks object

 src/engine/api/geary-endpoint.vala                 |  8 --------
 src/engine/api/geary-engine.vala                   | 15 ---------------
 src/engine/imap/api/imap-client-service.vala       | 12 ++++++++++++
 src/engine/imap/api/imap-quirks.vala               |  8 ++++++++
 src/engine/imap/transport/imap-client-session.vala |  2 +-
 5 files changed, 21 insertions(+), 24 deletions(-)
---
diff --git a/src/engine/api/geary-endpoint.vala b/src/engine/api/geary-endpoint.vala
index c833c92d..f986ed61 100644
--- a/src/engine/api/geary-endpoint.vala
+++ b/src/engine/api/geary-endpoint.vala
@@ -71,14 +71,6 @@ public class Geary.Endpoint : BaseObject {
         get; set; default = TlsCertificateFlags.VALIDATE_ALL;
     }
 
-    /**
-     * The maximum number of commands that will be pipelined at once.
-     *
-     * If 0 (the default), there is no limit on the number of
-     * pipelined commands sent to this endpoint.
-     */
-    public uint max_pipeline_batch_size = 0;
-
     /**
      * When set, TLS has reported certificate issues.
      *
diff --git a/src/engine/api/geary-engine.vala b/src/engine/api/geary-engine.vala
index 5f8f7143..c91b67ff 100644
--- a/src/engine/api/geary-engine.vala
+++ b/src/engine/api/geary-engine.vala
@@ -426,22 +426,7 @@ public class Geary.Engine : BaseObject {
             uint timeout = service.protocol == Protocol.IMAP
                 ? Imap.ClientConnection.RECOMMENDED_TIMEOUT_SEC
                 : Smtp.ClientConnection.DEFAULT_TIMEOUT_SEC;
-
             shared = new_endpoint(provider, service, timeout);
-
-            // XXX this is pretty hacky, move this back into the
-            // OutlookAccount somehow
-            if (provider == ServiceProvider.OUTLOOK) {
-                // As of June 2016, outlook.com's IMAP servers have a bug
-                // where a large number (~50) of pipelined STATUS commands on
-                // mailboxes with many messages will eventually cause it to
-                // break command parsing and return a BAD response, causing us
-                // to drop the connection. Limit the number of pipelined
-                // commands per batch to work around this.  See b.g.o Bug
-                // 766552
-                shared.max_pipeline_batch_size = 25;
-            }
-
             this.shared_endpoints.set(key, new EndpointWeakRef(shared));
         }
 
diff --git a/src/engine/imap/api/imap-client-service.vala b/src/engine/imap/api/imap-client-service.vala
index 419c0b1d..21a2e4aa 100644
--- a/src/engine/imap/api/imap-client-service.vala
+++ b/src/engine/imap/api/imap-client-service.vala
@@ -49,6 +49,18 @@ public class Geary.Imap.ClientService : Geary.ClientService {
             // around the former. See #746
             quirks.flag_atom_exceptions = "]";
             break;
+
+        case ServiceProvider.OUTLOOK:
+            // As of June 2016, outlook.com's IMAP servers have a bug
+            // where a large number (~50) of pipelined STATUS commands
+            // on mailboxes with many messages will eventually cause
+            // it to break command parsing and return a BAD response,
+            // causing us to drop the connection. Limit the number of
+            // pipelined commands per batch to work around this.  See
+            // b.g.o Bug 766552
+            quirks.max_pipeline_batch_size = 25;
+            break;
+
         default:
             // noop
             break;
diff --git a/src/engine/imap/api/imap-quirks.vala b/src/engine/imap/api/imap-quirks.vala
index cce53d46..2c1a70c6 100644
--- a/src/engine/imap/api/imap-quirks.vala
+++ b/src/engine/imap/api/imap-quirks.vala
@@ -14,5 +14,13 @@ public class Geary.Imap.Quirks : BaseObject {
     /** The set of additional characters allowed in an IMAP flag. */
     public string? flag_atom_exceptions { get; set; }
 
+    /**
+     * The maximum number of commands that will be pipelined at once.
+     *
+     * If 0 (the default), there is no limit on the number of
+     * pipelined commands sent to this endpoint.
+     */
+    public uint max_pipeline_batch_size { get; set; default = 0; }
+
 
 }
diff --git a/src/engine/imap/transport/imap-client-session.vala 
b/src/engine/imap/transport/imap-client-session.vala
index 13957422..f3f30a10 100644
--- a/src/engine/imap/transport/imap-client-session.vala
+++ b/src/engine/imap/transport/imap-client-session.vala
@@ -1290,7 +1290,7 @@ public class Geary.Imap.ClientSession : BaseObject, Logging.Source {
         // the endpoint's max pipeline size is positive, if so use
         // multiple batches with a maximum size of that.
 
-        uint max_batch_size = this.imap_endpoint.max_pipeline_batch_size;
+        uint max_batch_size = this.quirks.max_pipeline_batch_size;
         if (max_batch_size < 1) {
             max_batch_size = cmds.size;
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]