diff options
Diffstat (limited to 'server/user.go')
-rw-r--r-- | server/user.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/user.go b/server/user.go index 5865c93..aa78239 100644 --- a/server/user.go +++ b/server/user.go @@ -11,7 +11,8 @@ import ( ) type user struct { - dhtVal []byte + dhtVal []byte + phase int64 } var users map[string]user @@ -47,8 +48,8 @@ func persist(id string) { func userHandler(w http.ResponseWriter, r *http.Request) { id := r.URL.Fragment[6:] // Resolve ID to server list - val, err := dhtGet(id) - if err != nil || verify(id, val) != nil { + val := dhtGet(id, "") + if verify(id, val) != nil { w.WriteHeader(http.StatusNotFound) return } @@ -57,7 +58,7 @@ func userHandler(w http.ResponseWriter, r *http.Request) { if !strings.Contains(message, me) { // Delete user if they are no longer associated with this server delete(users, id) - err = os.RemoveAll(id) + err := os.RemoveAll(id) if err != nil { w.WriteHeader(http.StatusNotFound) return @@ -73,7 +74,7 @@ func userHandler(w http.ResponseWriter, r *http.Request) { users[id] = user{ dhtVal: val, } - os.Mkdir(id, 755) + os.Mkdir(id, 0755) persist(id) } } |