make passing bootstrap information optional

reason: allow the first node to start without having to wait for a
timeout
part of #58
This commit is contained in:
Trolli Schmittlauch 2020-09-03 11:20:38 +02:00
parent 59beb3441f
commit 20050654bc

View file

@ -45,13 +45,19 @@ main = do
readConfig :: IO (FediChordConf, ServiceConf)
readConfig = do
confDomainString : ipString : portString : bootstrapHost : bootstrapPortString : servicePortString : speedup : _ <- getArgs
confDomainString : ipString : portString : servicePortString : speedup : remainingArgs <- getArgs
-- allow starting the initial node without bootstrapping info to avoid
-- waiting for timeout
let
confBootstrapNodes' = case remainingArgs of
bootstrapHost : bootstrapPortString : _ ->
[(bootstrapHost, read bootstrapPortString)]
_ -> []
fConf = FediChordConf {
confDomain = confDomainString
, confIP = toHostAddress6 . read $ ipString
, confDhtPort = read portString
, confBootstrapNodes = [(bootstrapHost, read bootstrapPortString)]
, confBootstrapNodes = confBootstrapNodes'
--, confStabiliseInterval = 60
, confBootstrapSamplingInterval = 180
, confMaxLookupCacheAge = 300