mirror of
https://github.com/coalaura/up.git
synced 2025-07-17 21:44:35 +00:00
limit receive aswell
This commit is contained in:
@ -286,6 +286,18 @@ func HandleReceiveRequest(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
sessions.Delete(token)
|
sessions.Delete(token)
|
||||||
|
|
||||||
|
current, _, fail := rates.Inc(ip)
|
||||||
|
defer fail()
|
||||||
|
|
||||||
|
if current > MaxClientParallel || current == 0 {
|
||||||
|
w.WriteHeader(http.StatusTooManyRequests)
|
||||||
|
|
||||||
|
log.Warning("receive: too many requests")
|
||||||
|
log.WarningE(err)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
session := entry.(internal.SessionEntry)
|
session := entry.(internal.SessionEntry)
|
||||||
|
|
||||||
if session.Client != ip {
|
if session.Client != ip {
|
||||||
|
Reference in New Issue
Block a user