Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
modify connect() method of connPool to fix connection leak
  • Loading branch information
ikehara committed Jun 29, 2024
commit 7c73f23033187bf357fa03db4e4719ca84b94e9f
6 changes: 3 additions & 3 deletions proxycore/connpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,17 @@ func (p *connPool) connect() (conn *ClientConn, err error) {
if errors.Is(err, context.DeadlineExceeded) {
return nil, fmt.Errorf("handshake took longer than %s to complete", p.config.ConnectTimeout)
}
return nil, err
return conn, err
}
if version != p.config.Version {
p.logger.Error("protocol version not support", zap.Stringer("wanted", p.config.Version), zap.Stringer("got", version))
return nil, ProtocolNotSupported
return conn, ProtocolNotSupported
}

if len(p.config.Keyspace) != 0 {
err = conn.SetKeyspace(ctx, p.config.Version, p.config.Keyspace)
if err != nil {
return nil, err
return conn, err
}
}

Expand Down