communicator/ssh: explicitly set c.conn = nil
This commit is contained in:
parent
94487871ad
commit
65d391dbeb
|
@ -8,6 +8,8 @@ BUG FIXES:
|
|||
* builder/digitalocean: scrub API keys from config debug output [GH-516]
|
||||
* builder/virtualbox: error if VirtualBox version cant be detected. [GH-488]
|
||||
* builder/virtualbox: detect if vboxdrv isn't properly setup. [GH-488]
|
||||
* communicator/ssh: Fix issue where a panic could arise from a nil
|
||||
dereference. [GH-525]
|
||||
|
||||
## 0.3.9 (October 2, 2013)
|
||||
|
||||
|
|
|
@ -238,6 +238,14 @@ func (c *comm) reconnect() (err error) {
|
|||
log.Printf("reconnecting to TCP connection for SSH")
|
||||
c.conn, err = c.config.Connection()
|
||||
if err != nil {
|
||||
// Explicitly set this to the REAL nil. Connection() can return
|
||||
// a nil implementation of net.Conn which will make the
|
||||
// "if c.conn == nil" check fail above. Read here for more information
|
||||
// on this psychotic language feature:
|
||||
//
|
||||
// http://golang.org/doc/faq#nil_error
|
||||
c.conn = nil
|
||||
|
||||
log.Printf("reconnection error: %s", err)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue