data structure for RealNode holds common config and management data

contributes to #56, #34, #2
This commit is contained in:
Trolli Schmittlauch 2020-07-07 17:34:42 +02:00
parent df7423ce2e
commit d293cc05d1
4 changed files with 55 additions and 14 deletions

View file

@ -16,10 +16,13 @@ main = do
-- ToDo: parse and pass config
-- probably use `tomland` for that
conf <- readConfig
-- TODO: first initialise 'RealNode', then the vservers
-- ToDo: load persisted caches, bootstrapping nodes …
(serverSock, thisNode) <- fediChordInit conf
-- currently no masking is necessary, as there is nothing to clean up
cacheWriterThread <- forkIO $ cacheWriter thisNode
thisNodeSnap <- readTVarIO thisNode
realNode <- readTVarIO $ parentRealNode thisNodeSnap
-- try joining the DHT using one of the provided bootstrapping nodes
let
tryJoining (bn:bns) = do
@ -28,7 +31,7 @@ main = do
Left err -> putStrLn ("join error: " <> err) >> tryJoining bns
Right joined -> pure $ Right joined
tryJoining [] = pure $ Left "Exhausted all bootstrap points for joining."
joinedState <- tryJoining $ confBootstrapNodes conf
joinedState <- tryJoining $ bootstrapNodes realNode
either (\err -> do
-- handle unsuccessful join