[Spice-commits] gtk/spice-channel.c gtk/spice-session.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Mon Feb 13 03:06:18 PST 2012


 gtk/spice-channel.c |   11 ++++++-----
 gtk/spice-session.c |    2 ++
 2 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 8fe6547b6181fb7acbabedcd6ed95caf263dd8cc
Author: Nicolas Prochazka <prochazka.nicolas at gmail.com>
Date:   Mon Feb 13 12:05:03 2012 +0100

    Set keepalive on channel socket
    
    Without keepalive on each connection(channel), channel is destroyed
    after ip_conntrack_tcp_timeout_established timeout.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=45899

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index afcee98..feeeff2 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2091,12 +2091,13 @@ static void *spice_channel_coroutine(void *data)
             goto cleanup;
         }
 
-	if (!(c->sock = g_socket_new_from_fd(c->fd, NULL))) {
-		SPICE_DEBUG("Failed to open socket from fd %d", c->fd);
-		return FALSE;
-	}
+        if (!(c->sock = g_socket_new_from_fd(c->fd, NULL))) {
+                SPICE_DEBUG("Failed to open socket from fd %d", c->fd);
+                return FALSE;
+        }
 
-	g_socket_set_blocking(c->sock, FALSE);
+        g_socket_set_blocking(c->sock, FALSE);
+        g_socket_set_keepalive(c->sock, TRUE);
         goto connected;
     }
 
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 33c297a..c328f66 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -1417,6 +1417,8 @@ static GSocket *channel_connect_socket(SpiceChannel *channel,
         return NULL;
 
     g_socket_set_blocking(sock, FALSE);
+    g_socket_set_keepalive(sock, TRUE);
+
     if (!g_socket_connect(sock, sockaddr, NULL, error)) {
         if (*error && (*error)->code == G_IO_ERROR_PENDING) {
             g_clear_error(error);


More information about the Spice-commits mailing list