소스 검색

go.crypto/ssh: only close connection if it was open in TestClientUnsupportedKex.

R=dave
CC=golang-dev
https://golang.org/cl/15450046
Han-Wen Nienhuys 12 년 전
부모
커밋
105632d35b
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      ssh/client_auth_test.go

+ 2 - 0
ssh/client_auth_test.go

@@ -361,6 +361,8 @@ func TestClientUnsupportedKex(t *testing.T) {
 	c, err := Dial("tcp", newMockAuthServer(t), config)
 	c, err := Dial("tcp", newMockAuthServer(t), config)
 	if err == nil || !strings.Contains(err.Error(), "no common algorithms") {
 	if err == nil || !strings.Contains(err.Error(), "no common algorithms") {
 		t.Errorf("got %v, expected 'no common algorithms'", err)
 		t.Errorf("got %v, expected 'no common algorithms'", err)
+	}
+	if c != nil {
 		c.Close()
 		c.Close()
 	}
 	}
 }
 }