diff options
Diffstat (limited to 'cmd/web/index.go')
| -rw-r--r-- | cmd/web/index.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cmd/web/index.go b/cmd/web/index.go index 970810f..3121384 100644 --- a/cmd/web/index.go +++ b/cmd/web/index.go @@ -129,10 +129,14 @@ Change library path ) func index(w http.ResponseWriter, r *http.Request) { - libMu.RLock() - defer libMu.RUnlock() - status.m.RLock() - defer status.m.RUnlock() + // During rendering of the template I believe it's + // mutating during the sort of keys, so Lib no longer + // is an RWMutex and we're just locking this as if + // we're writing to it + Lib.Lock() + defer Lib.Unlock() + status.Lock() + defer status.Unlock() err := Templ.ExecuteTemplate(w, "index", struct { @@ -143,8 +147,8 @@ func index(w http.ResponseWriter, r *http.Request) { Port string Version string }{ - Lib, - status.s, + &Lib.Library, + status, isLocal(r.RemoteAddr), getHostIP(), getPort(), |
