[evolution-data-server] [IMAPx] IDLE call timeouts for STARTTLS connections



commit 94c9a1f27c42fb6b304c40b727b46463b8b246fe
Author: Milan Crha <mcrha redhat com>
Date:   Thu Mar 12 08:39:13 2015 +0100

    [IMAPx] IDLE call timeouts for STARTTLS connections
    
    The STARTTLS connection uses GTLSConnection, which is a wrapper
    on top of a real (socket) connection. This GTLSConnection is not
    a descendant of GSocketConnection, thus the timeout was never changed
    in imapx_server_set_connection_timeout().

 camel/providers/imapx/camel-imapx-server.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 118e73e..b53a9e5 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -1220,8 +1220,20 @@ imapx_server_set_connection_timeout (GIOStream *connection,
        GSocket *socket;
        gint previous_timeout = -1;
 
-       if (!G_IS_SOCKET_CONNECTION (connection))
+       if (G_IS_TLS_CONNECTION (connection)) {
+               GIOStream *base_io_stream = NULL;
+
+               g_object_get (G_OBJECT (connection), "base-io-stream", &base_io_stream, NULL);
+
+               connection = base_io_stream;
+       } else {
+               g_object_ref (connection);
+       }
+
+       if (!G_IS_SOCKET_CONNECTION (connection)) {
+               g_clear_object (&connection);
                return previous_timeout;
+       }
 
        socket = g_socket_connection_get_socket (G_SOCKET_CONNECTION (connection));
        if (socket) {
@@ -1229,6 +1241,8 @@ imapx_server_set_connection_timeout (GIOStream *connection,
                g_socket_set_timeout (socket, timeout_seconds);
        }
 
+       g_clear_object (&connection);
+
        return previous_timeout;
 }
 


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