The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4666

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
With out keep alive, lxc will block indefinitely when there is network change.
From 31e017c10f1a62347e12456ed16d60d662eacdc6 Mon Sep 17 00:00:00 2001
From: Jingkui Wang <jkw...@google.com>
Date: Mon, 18 Jun 2018 09:44:22 -0700
Subject: [PATCH] Enable tcp KeepAlive

This will stop lxc from block indefinitely when there is network change.
---
 shared/network.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/shared/network.go b/shared/network.go
index 2ccb7dc8c..f47f75cea 100644
--- a/shared/network.go
+++ b/shared/network.go
@@ -31,6 +31,10 @@ func RFC3493Dialer(network, address string) (net.Conn, 
error) {
                if err != nil {
                        continue
                }
+               if tc, ok := c.(*net.TCPConn); ok {
+                       tc.SetKeepAlive(true)
+                       tc.SetKeepAlivePeriod(3 * time.Second)
+               }
                return c, err
        }
        return nil, fmt.Errorf("Unable to connect to: " + address)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to