packer/plugin: set TCP keep-alive on connection
This commit is contained in:
parent
7647b12eab
commit
de1e94eb90
|
@ -15,6 +15,7 @@ IMPROVEMENTS:
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
|
* core: TCP connection between plugin processes will keep-alive. [GH-312]
|
||||||
* core: No more "unused key keep_input_artifact" for post processors [GH-310]
|
* core: No more "unused key keep_input_artifact" for post processors [GH-310]
|
||||||
* post-processor/vagrant: `output_path` templates now work again.
|
* post-processor/vagrant: `output_path` templates now work again.
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
"net"
|
||||||
"net/rpc"
|
"net/rpc"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -328,10 +329,14 @@ func (c *Client) rpcClient() (*rpc.Client, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := rpc.Dial("tcp", address)
|
conn, err := net.Dial("tcp", address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return client, nil
|
// Make sure to set keep alive so that the connection doesn't die
|
||||||
|
tcpConn := conn.(*net.TCPConn)
|
||||||
|
tcpConn.SetKeepAlive(true)
|
||||||
|
|
||||||
|
return rpc.NewClient(tcpConn), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue