mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-10 15:43:09 -06:00
Re-add read lock
This commit is contained in:
parent
91bffae350
commit
0e0ab48c92
|
|
@ -69,6 +69,13 @@ func (l *RateLimits) Limit(req *http.Request, device *userapi.Device) *util.JSON
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Take a read lock out on the cleaner mutex. The cleaner expects to
|
||||||
|
// be able to take a write lock, which isn't possible while there are
|
||||||
|
// readers, so this has the effect of blocking the cleaner goroutine
|
||||||
|
// from doing its work until there are no requests in flight.
|
||||||
|
l.cleanMutex.RLock()
|
||||||
|
defer l.cleanMutex.RUnlock()
|
||||||
|
|
||||||
// First of all, work out if X-Forwarded-For was sent to us. If not
|
// First of all, work out if X-Forwarded-For was sent to us. If not
|
||||||
// then we'll just use the IP address of the caller.
|
// then we'll just use the IP address of the caller.
|
||||||
var caller string
|
var caller string
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue