refactor trying to join on any bootstrap node into own function
contributes to #56
This commit is contained in:
parent
d293cc05d1
commit
56ca2b53cc
2 changed files with 21 additions and 10 deletions
11
app/Main.hs
11
app/Main.hs
|
@ -21,17 +21,8 @@ main = do
|
|||
(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
|
||||
j <- fediChordBootstrapJoin thisNode bn
|
||||
case j of
|
||||
Left err -> putStrLn ("join error: " <> err) >> tryJoining bns
|
||||
Right joined -> pure $ Right joined
|
||||
tryJoining [] = pure $ Left "Exhausted all bootstrap points for joining."
|
||||
joinedState <- tryJoining $ bootstrapNodes realNode
|
||||
joinedState <- tryBootstrapJoining thisNode
|
||||
either (\err -> do
|
||||
-- handle unsuccessful join
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue