communicator/ssh: set TCP keep-alive [GH-872]
This commit is contained in:
parent
eacac89a24
commit
9d55fa7f46
|
@ -20,6 +20,7 @@ BUG FIXES:
|
||||||
checksum type is "none"
|
checksum type is "none"
|
||||||
* builder/virtualbox,vmware/qemu: Support for additional scancodes for
|
* builder/virtualbox,vmware/qemu: Support for additional scancodes for
|
||||||
`boot_command` such as `<up>`, `<left>`, `<insert>`, etc. [GH-808]
|
`boot_command` such as `<up>`, `<left>`, `<insert>`, etc. [GH-808]
|
||||||
|
* communicator/ssh: Send TCP keep-alives on connections. [GH-872]
|
||||||
* provisioners/ansible-local: Properly upload custom playbooks. [GH-829]
|
* provisioners/ansible-local: Properly upload custom playbooks. [GH-829]
|
||||||
|
|
||||||
## 0.5.1 (01/02/2014)
|
## 0.5.1 (01/02/2014)
|
||||||
|
|
|
@ -10,6 +10,13 @@ import (
|
||||||
// is suitable for use with the SSH communicator configuration.
|
// is suitable for use with the SSH communicator configuration.
|
||||||
func ConnectFunc(network, addr string) func() (net.Conn, error) {
|
func ConnectFunc(network, addr string) func() (net.Conn, error) {
|
||||||
return func() (net.Conn, error) {
|
return func() (net.Conn, error) {
|
||||||
return net.DialTimeout(network, addr, 15*time.Second)
|
c, err := net.DialTimeout(network, addr, 15*time.Second)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if tcpConn, ok := c.(*net.TCPConn); ok {
|
||||||
|
tcpConn.SetKeepAlive(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue