1
0
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:
Laura
2025-06-20 22:54:07 +02:00
parent 82a1d3444a
commit c7d01ae844

View File

@ -286,6 +286,18 @@ func HandleReceiveRequest(w http.ResponseWriter, r *http.Request) {
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)
if session.Client != ip {