Cleanup some resources we may have created

This commit is contained in:
Chris Bednarski 2015-07-02 03:55:18 -07:00
parent 03850cafc6
commit 5dd8ae45c7
2 changed files with 7 additions and 1 deletions

View File

@ -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 connect or timeout.
case <-timeoutExceeded:
if c.conn != nil {
c.conn.Close()
}
if sshConn != nil {
sshConn.Close()
}
return ErrHandshakeTimeout
}

View File

@ -111,8 +111,8 @@ func newMockBrokenServer(t *testing.T) string {
defer c.Close()
// This should block for a period of time longer than our timeout in
// the test case. That way we invoke a failure scenario.
time.Sleep(5 * time.Second)
t.Log("Block on handshaking for SSH connection")
time.Sleep(5 * time.Second)
}()
return l.Addr().String()