implemented priority preloading

This commit is contained in:
ston1th 2022-05-03 22:14:47 +02:00
commit eb6272e411
7 changed files with 134 additions and 107 deletions

View file

@ -85,11 +85,16 @@ func (fs *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
if !d.IsDir() {
if option == "p" || option == "s" {
if option == "p" {
fs.fs.Preload(p)
} else if option == "s" {
fs.fs.CancelPreload(p)
if option == "p" || option == "i" || option == "d" || option == "s" {
switch option {
case "p":
fs.fs.Preload(p, 0)
case "i":
fs.fs.Preload(p, 1)
case "d":
fs.fs.Preload(p, -1)
case "s":
fs.fs.RemovePreload(p)
}
rdir := "/"
if r.FormValue("r") == "preloads" {