diff options
Diffstat (limited to 'server/main.go')
-rw-r--r-- | server/main.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/server/main.go b/server/main.go index b4fc654..a342ba5 100644 --- a/server/main.go +++ b/server/main.go @@ -30,14 +30,23 @@ func main() { peerHashes = append(peerHashes, sha256sum(me)) hashToDomain = map[string]string{peerHashes[0]: me} + // Start background functions if initialPeer != "" { go addPeer(initialPeer) } go cleanPeers() go cleanKVStore() + go redistributeKeys() // Load user data from disk - entries, _ := os.ReadDir(dataDir) + err := os.Mkdir(dataDir, 0755) + if err != nil { + log.Fatal(err) + } + entries, err := os.ReadDir(dataDir) + if err != nil { + log.Fatal(err) + } for _, entry := range entries { id := entry.Name() reader, err := os.Open(dataDir + "/" + id + "/gob") |