Skip to content

Commit

Permalink
Fix the handling of a race where the connection is closed between the…
Browse files Browse the repository at this point in the history
… isClosing test at the top of sendMessageWithFlags, and a subsequently ignored test in sendProcessMessage
  • Loading branch information
sgmiller committed Apr 30, 2020
1 parent 83f96f1 commit 17f2372
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion conn.go
Expand Up @@ -390,7 +390,12 @@ func (l *Conn) sendMessageWithFlags(packet *ber.Packet, flags sendMessageFlags)
responses: responses,
},
}
l.sendProcessMessage(message)
if !l.sendProcessMessage(message) {
if l.IsClosing() {
return nil, NewError(ErrorNetwork, errors.New("ldap: connection closed"))
}
return nil, NewError(ErrorNetwork, errors.New("ldap: could not send message for unknown reason"))
}
return message.Context, nil
}

Expand Down

0 comments on commit 17f2372

Please sign in to comment.