try all bootstrap nodes until successfully joined
This commit is contained in:
parent
702684b1a9
commit
b1c5c5e5f4
|
@ -17,12 +17,20 @@ main = do
|
||||||
print serverSock
|
print serverSock
|
||||||
-- currently no masking is necessary, as there is nothing to clean up
|
-- currently no masking is necessary, as there is nothing to clean up
|
||||||
cacheWriterThread <- forkIO $ cacheWriter thisNode
|
cacheWriterThread <- forkIO $ cacheWriter thisNode
|
||||||
-- idea: list of bootstrapping nodes, try joining within a timeout
|
-- try joining the DHT using one of the provided bootstrapping nodes
|
||||||
joinedState <- fediChordBootstrapJoin thisNode $ head . confBootstrapNodes $ conf
|
let
|
||||||
|
tryJoining (bn:bns) = do
|
||||||
|
j <- fediChordBootstrapJoin thisNode bn
|
||||||
|
case j of
|
||||||
|
Left _ -> tryJoining bns
|
||||||
|
Right joined -> pure $ Right joined
|
||||||
|
tryJoining [] = pure $ Left "Exhausted all bootstrap points for joining."
|
||||||
|
joinedState <- tryJoining $ confBootstrapNodes conf
|
||||||
-- stop main thread from terminating during development
|
-- stop main thread from terminating during development
|
||||||
getChar
|
getChar
|
||||||
pure ()
|
pure ()
|
||||||
|
|
||||||
|
|
||||||
readConfig :: IO FediChordConf
|
readConfig :: IO FediChordConf
|
||||||
readConfig = do
|
readConfig = do
|
||||||
confDomainString : ipString : portString : bootstrapHost : bootstrapPortString : _ <- getArgs
|
confDomainString : ipString : portString : bootstrapHost : bootstrapPortString : _ <- getArgs
|
||||||
|
|
Loading…
Reference in a new issue