mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-09 01:48:10 -07:00
explain why CheckPassword happens in client thread
This commit is contained in:
@@ -67,6 +67,11 @@ func (client *Client) run() {
|
||||
checkPass, ok := command.(checkPasswordCommand)
|
||||
if ok {
|
||||
checkPass.LoadPassword(client.server)
|
||||
// Block the client thread while handling a potentially expensive
|
||||
// password bcrypt operation. Since the server is single-threaded
|
||||
// for commands, we don't want the server to perform the bcrypt,
|
||||
// blocking anyone else from sending commands until it
|
||||
// completes. This could be a form of DoS if handled naively.
|
||||
checkPass.CheckPassword()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user