Skip to content

Commit

Permalink
close failed connections (#6898)
Browse files Browse the repository at this point in the history
Signed-off-by: abhishek818 <[email protected]>
  • Loading branch information
abhishek818 committed Jul 22, 2024
1 parent 8574aa6 commit 5bdec11
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions services/auth/source/ldap/source_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func dial(source *Source) (*ldap.Conn, error) {
conn, err := ldap.DialTLS("tcp", net.JoinHostPort(host, strconv.Itoa(source.Port)), tlsConfig)
if err != nil {
// Connection failed, try again with the next host.
conn.Close()
log.Trace("error during Dial for host %s: %w", host, err)
continue
}
Expand All @@ -139,6 +140,7 @@ func dial(source *Source) (*ldap.Conn, error) {

conn, err := ldap.Dial("tcp", net.JoinHostPort(host, strconv.Itoa(source.Port)))
if err != nil {
conn.Close()
log.Trace("error during Dial for host %s: %w", host, err)
continue
}
Expand Down

0 comments on commit 5bdec11

Please sign in to comment.