[geary] Remove the TCP graceful disconnect implementation. Bug 757088.



commit 952172c1f15302c8f292a32e20782d8a0281d4e6
Author: Michael James Gratton <mike vee net>
Date:   Wed Apr 20 16:08:09 2016 +1000

    Remove the TCP graceful disconnect implementation. Bug 757088.
    
    Since both IMAP and SMTP implement graceful disconnect at the application
    protocol level, doing it again at the TCP level is redundant.
    
    The use of graceful disconnect was introduced as part of the fix for Bug
    713736, but it is not clear why it was included. Removing it also fixes
    Bug 757088, which can cause the UI to freeze if the connection is
    lost (e.g. on wifi drop out).
    
    * src/engine/api/geary-endpoint.vala (Flags): Remove GRACEFUL_DISCONNECT
      and all references to it in other code.
      (SocketConnection::connect_async): Remove the conditional enabling
      TcpConnection::set_graceful_disconnect.

 src/console/main.vala                              |    2 +-
 src/engine/api/geary-account-information.vala      |    4 ++--
 src/engine/api/geary-endpoint.vala                 |   11 ++---------
 .../gmail/imap-engine-gmail-account.vala           |    4 ++--
 .../outlook/imap-engine-outlook-account.vala       |    4 ++--
 .../yahoo/imap-engine-yahoo-account.vala           |    4 ++--
 src/mailer/main.vala                               |    4 ++--
 7 files changed, 13 insertions(+), 20 deletions(-)
---
diff --git a/src/console/main.vala b/src/console/main.vala
index 720cd72..a67017a 100644
--- a/src/console/main.vala
+++ b/src/console/main.vala
@@ -306,7 +306,7 @@ class ImapConsole : Gtk.Window {
         
         check_args(cmd, args, 1, "hostname[:port]");
         
-        Geary.Endpoint.Flags flags = Geary.Endpoint.Flags.GRACEFUL_DISCONNECT;
+        Geary.Endpoint.Flags flags = Geary.Endpoint.Flags.NONE;
         if (cmd != "unsecure")
             flags |= Geary.Endpoint.Flags.SSL;
         
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index 3fa8cee..04bb659 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -615,7 +615,7 @@ public class Geary.AccountInformation : BaseObject {
             break;
             
             case ServiceProvider.OTHER:
-                Endpoint.Flags imap_flags = Endpoint.Flags.GRACEFUL_DISCONNECT;
+                Endpoint.Flags imap_flags = Endpoint.Flags.NONE;
                 if (default_imap_server_ssl)
                     imap_flags |= Endpoint.Flags.SSL;
                 if (default_imap_server_starttls)
@@ -669,7 +669,7 @@ public class Geary.AccountInformation : BaseObject {
             break;
             
             case ServiceProvider.OTHER:
-                Endpoint.Flags smtp_flags = Endpoint.Flags.GRACEFUL_DISCONNECT;
+                Endpoint.Flags smtp_flags = Endpoint.Flags.NONE;
                 if (default_smtp_server_ssl)
                     smtp_flags |= Endpoint.Flags.SSL;
                 if (default_smtp_server_starttls)
diff --git a/src/engine/api/geary-endpoint.vala b/src/engine/api/geary-endpoint.vala
index f9be15a..14ee0ea 100644
--- a/src/engine/api/geary-endpoint.vala
+++ b/src/engine/api/geary-endpoint.vala
@@ -16,8 +16,7 @@ public class Geary.Endpoint : BaseObject {
     public enum Flags {
         NONE = 0,
         SSL,
-        STARTTLS,
-        GRACEFUL_DISCONNECT;
+        STARTTLS;
         
         public inline bool is_all_set(Flags flags) {
             return (this & flags) == flags;
@@ -138,13 +137,7 @@ public class Geary.Endpoint : BaseObject {
     }
 
     public async SocketConnection connect_async(Cancellable? cancellable = null) throws Error {
-        SocketConnection cx = yield get_socket_client().connect_async(remote_address, cancellable);
-        
-        TcpConnection? tcp = cx as TcpConnection;
-        if (tcp != null)
-            tcp.set_graceful_disconnect(flags.is_all_set(Flags.GRACEFUL_DISCONNECT));
-        
-        return cx;
+        return yield get_socket_client().connect_async(remote_address, cancellable);
     }
     
     public async TlsClientConnection starttls_handshake_async(IOStream base_stream,
diff --git a/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala 
b/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
index 213c8c7..71c7742 100644
--- a/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
+++ b/src/engine/imap-engine/gmail/imap-engine-gmail-account.vala
@@ -9,7 +9,7 @@ private class Geary.ImapEngine.GmailAccount : Geary.ImapEngine.GenericAccount {
         return new Geary.Endpoint(
             "imap.gmail.com",
             Imap.ClientConnection.DEFAULT_PORT_SSL,
-            Geary.Endpoint.Flags.SSL | Geary.Endpoint.Flags.GRACEFUL_DISCONNECT,
+            Geary.Endpoint.Flags.SSL,
             Imap.ClientConnection.RECOMMENDED_TIMEOUT_SEC);
     }
     
@@ -17,7 +17,7 @@ private class Geary.ImapEngine.GmailAccount : Geary.ImapEngine.GenericAccount {
         return new Geary.Endpoint(
             "smtp.gmail.com",
             Smtp.ClientConnection.DEFAULT_PORT_SSL,
-            Geary.Endpoint.Flags.SSL | Geary.Endpoint.Flags.GRACEFUL_DISCONNECT,
+            Geary.Endpoint.Flags.SSL,
             Smtp.ClientConnection.DEFAULT_TIMEOUT_SEC);
     }
     
diff --git a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala 
b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
index 9b9a1c1..ebc2d03 100644
--- a/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
+++ b/src/engine/imap-engine/outlook/imap-engine-outlook-account.vala
@@ -9,7 +9,7 @@ private class Geary.ImapEngine.OutlookAccount : Geary.ImapEngine.GenericAccount
         return new Geary.Endpoint(
             "imap-mail.outlook.com",
             Imap.ClientConnection.DEFAULT_PORT_SSL,
-            Geary.Endpoint.Flags.SSL | Geary.Endpoint.Flags.GRACEFUL_DISCONNECT,
+            Geary.Endpoint.Flags.SSL,
             Imap.ClientConnection.RECOMMENDED_TIMEOUT_SEC);
     }
     
@@ -17,7 +17,7 @@ private class Geary.ImapEngine.OutlookAccount : Geary.ImapEngine.GenericAccount
         return new Geary.Endpoint(
             "smtp-mail.outlook.com",
             Smtp.ClientConnection.DEFAULT_PORT_STARTTLS,
-            Geary.Endpoint.Flags.STARTTLS | Geary.Endpoint.Flags.GRACEFUL_DISCONNECT,
+            Geary.Endpoint.Flags.STARTTLS,
             Smtp.ClientConnection.DEFAULT_TIMEOUT_SEC);
     }
     
diff --git a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala 
b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
index 7b47c00..de2ed92 100644
--- a/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
+++ b/src/engine/imap-engine/yahoo/imap-engine-yahoo-account.vala
@@ -9,7 +9,7 @@ private class Geary.ImapEngine.YahooAccount : Geary.ImapEngine.GenericAccount {
         return new Geary.Endpoint(
             "imap.mail.yahoo.com",
             Imap.ClientConnection.DEFAULT_PORT_SSL,
-            Geary.Endpoint.Flags.SSL | Geary.Endpoint.Flags.GRACEFUL_DISCONNECT,
+            Geary.Endpoint.Flags.SSL,
             Imap.ClientConnection.RECOMMENDED_TIMEOUT_SEC);
     }
     
@@ -17,7 +17,7 @@ private class Geary.ImapEngine.YahooAccount : Geary.ImapEngine.GenericAccount {
         return new Geary.Endpoint(
             "smtp.mail.yahoo.com",
             Smtp.ClientConnection.DEFAULT_PORT_SSL,
-            Geary.Endpoint.Flags.SSL | Geary.Endpoint.Flags.GRACEFUL_DISCONNECT,
+            Geary.Endpoint.Flags.SSL,
             Smtp.ClientConnection.DEFAULT_TIMEOUT_SEC);
     }
     
diff --git a/src/mailer/main.vala b/src/mailer/main.vala
index 8426bf7..faa2d4b 100644
--- a/src/mailer/main.vala
+++ b/src/mailer/main.vala
@@ -138,10 +138,10 @@ int main(string[] args) {
     
     if (arg_gmail) {
         endpoint = new Geary.Endpoint("smtp.gmail.com", Geary.Smtp.ClientConnection.DEFAULT_PORT_STARTTLS,
-            Geary.Endpoint.Flags.STARTTLS | Geary.Endpoint.Flags.GRACEFUL_DISCONNECT,
+            Geary.Endpoint.Flags.STARTTLS,
             Geary.Smtp.ClientConnection.DEFAULT_TIMEOUT_SEC);
     } else {
-        Geary.Endpoint.Flags flags = Geary.Endpoint.Flags.GRACEFUL_DISCONNECT;
+        Geary.Endpoint.Flags flags = Geary.Endpoint.Flags.NONE;
         if (!arg_no_tls)
             flags |= Geary.Endpoint.Flags.SSL;
         


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