Commit de1e94eb authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer/plugin: set TCP keep-alive on connection

parent 7647b12e
...@@ -15,6 +15,7 @@ IMPROVEMENTS: ...@@ -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 ( ...@@ -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) { ...@@ -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
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment