Changes
3 changed files (+7/-9)
-
-
@@ -2,7 +2,6 @@ package mainimport ( "bytes" "crypto/ed25519" "crypto/sha256" "encoding/base64" "encoding/binary"
-
@@ -114,12 +113,11 @@ go addPeer(peer)} // Get the timestamp of this val func timestamp(val []byte) int64 { if len(val) < 8+ed25519.SignatureSize { func timestamp(val []byte) uint64 { if len(val) < 8 { return 0 } ret, _ := binary.Varint(val[:8]) return ret return binary.LittleEndian.Uint64(val) } // Get the value for a key from the DHT
-
-
-
@@ -43,7 +43,7 @@ }op := user.log[idx] mu.Unlock() file, _ := os.Open(op) file, _ := os.Open(dataDir + "/" + id + "/" + op) resp, err := http.Post(s+"/storage/"+id+"/"+op+"?idx="+fmt.Sprint(idx), "application/octet-stream", file) if err != nil { time.Sleep(50 * time.Millisecond)
-
@@ -124,7 +124,6 @@ }b, err := io.ReadAll(r.Body) if err != nil { log.Print(err) w.WriteHeader(http.StatusInternalServerError) return }
-
@@ -184,5 +183,6 @@ w.WriteHeader(http.StatusInternalServerError)return } user.log = append(user.log, filename) w.Write([]byte(fmt.Sprint(len(user.log)))) } }
-
-
-
@@ -83,7 +83,7 @@ }persist(id) if !inServers { delete(users, id) _ = os.RemoveAll(id) _ = os.RemoveAll(dataDir + "/" + id) } }
-
@@ -99,7 +99,7 @@ }mu.Lock() if _, ok := users[id]; !ok { // Add user users[id] = &user{dhtVal: val} users[id] = &user{dhtVal: val, phase: 0} os.Mkdir(dataDir+"/"+id, 0755) persist(id) }
-