diff options
author | Nicolas Prochazka <prochazka.nicolas@gmail.com> | 2012-02-13 12:05:03 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-02-13 12:05:03 +0100 |
commit | 8fe6547b6181fb7acbabedcd6ed95caf263dd8cc (patch) | |
tree | d606fa8cbb882f65cba3b29ca6be2001b135b452 | |
parent | c2447b43378f01776d11dad48987ab8e0b4fe8bf (diff) |
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
-rw-r--r-- | gtk/spice-channel.c | 11 | ||||
-rw-r--r-- | gtk/spice-session.c | 2 |
2 files changed, 8 insertions, 5 deletions
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); |