mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-03 08:28:31 +00:00
Refuse connections if not enough RAM
This commit is contained in:
parent
0c1d6ed725
commit
da790fbaa6
4 changed files with 40 additions and 3 deletions
|
@ -107,6 +107,13 @@ var BannerHTML []byte
|
|||
// It either uses the SocketUpgrader or writes out the BannerHTML.
|
||||
func HTTPHandleRootURL(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Header.Get("Connection") == "Upgrade" {
|
||||
updateSysMem()
|
||||
|
||||
if Statistics.SysMemTotal-Statistics.SysMemFree < Configuration.MinMemoryBytes {
|
||||
w.WriteHeader(503)
|
||||
return
|
||||
}
|
||||
|
||||
conn, err := SocketUpgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
fmt.Fprintf(w, "error: %v", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue