Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 9b36850

Browse files
authored
Merge pull request ClickHouse#288 from jtroy/exception-stay-open
Don't close the connection after a server exception is received.
2 parents 022a1ec + 0a255e5 commit 9b36850

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

bootstrap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ func open(dsn string) (*clickhouse, error) {
207207
ch.encoder = binary.NewEncoderWithCompress(ch.buffer)
208208

209209
if err := ch.hello(database, username, password); err != nil {
210+
ch.conn.Close()
210211
return nil, err
211212
}
212213
return &ch, nil
@@ -245,7 +246,6 @@ func (ch *clickhouse) hello(database, username, password string) error {
245246
ch.logf("[bootstrap] <- end of stream")
246247
return nil
247248
default:
248-
ch.conn.Close()
249249
return fmt.Errorf("[hello] unexpected packet [%d] from server", packet)
250250
}
251251
}

clickhouse_exception.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ func (e *Exception) Error() string {
1818
}
1919

2020
func (ch *clickhouse) exception() error {
21-
defer ch.conn.Close()
2221
var (
2322
e Exception
2423
err error

0 commit comments

Comments
 (0)