locks
parent
efe4adf129
commit
c153636e24
|
|
@ -11,6 +11,7 @@ import (
|
|||
"mayhem-party/src/device/input/wrap"
|
||||
"net/http"
|
||||
"os"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
|
|
@ -69,9 +70,17 @@ func (v01 *V01) listen() {
|
|||
if v01.cfg.Feedback.Addr == "" {
|
||||
return
|
||||
}
|
||||
mutex := &sync.RWMutex{}
|
||||
s := &http.Server{
|
||||
Addr: v01.cfg.Feedback.Addr,
|
||||
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == http.MethodGet {
|
||||
mutex.RLock()
|
||||
defer mutex.RUnlock()
|
||||
} else {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
}
|
||||
if r.Method == http.MethodGet {
|
||||
r = r.WithContext(v01.ctx)
|
||||
user, ok := v01.cfg.Users[r.URL.Query().Get("user")]
|
||||
|
|
|
|||
Loading…
Reference in New Issue