Add partial context support to handleUserUpdate

More plumbing needed to make sure we don't block too long waiting
for the reply.
This commit is contained in:
Simon Ser 2021-11-08 19:48:32 +01:00
parent 22f9ce1b86
commit e3b1930bf2

View file

@ -813,11 +813,17 @@ func handleUserUpdate(ctx context.Context, dc *downstreamConn, params []string)
}
done := make(chan error, 1)
u.events <- eventUserUpdate{
event := eventUserUpdate{
password: hashed,
admin: admin,
done: done,
}
select {
case <-ctx.Done():
return ctx.Err()
case u.events <- event:
}
// TODO: send context to the other side
if err := <-done; err != nil {
return err
}