Commit 5dd8ae45 authored by Chris Bednarski's avatar Chris Bednarski

Cleanup some resources we may have created

parent 03850caf
...@@ -308,6 +308,12 @@ func (c *comm) reconnect() (err error) { ...@@ -308,6 +308,12 @@ func (c *comm) reconnect() (err error) {
// We don't need to do anything here. We just want select to block until // We don't need to do anything here. We just want select to block until
// we connect or timeout. // we connect or timeout.
case <-timeoutExceeded: case <-timeoutExceeded:
if c.conn != nil {
c.conn.Close()
}
if sshConn != nil {
sshConn.Close()
}
return ErrHandshakeTimeout return ErrHandshakeTimeout
} }
......
...@@ -111,8 +111,8 @@ func newMockBrokenServer(t *testing.T) string { ...@@ -111,8 +111,8 @@ func newMockBrokenServer(t *testing.T) string {
defer c.Close() defer c.Close()
// This should block for a period of time longer than our timeout in // This should block for a period of time longer than our timeout in
// the test case. That way we invoke a failure scenario. // the test case. That way we invoke a failure scenario.
time.Sleep(5 * time.Second)
t.Log("Block on handshaking for SSH connection") t.Log("Block on handshaking for SSH connection")
time.Sleep(5 * time.Second)
}() }()
return l.Addr().String() return l.Addr().String()
......
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