From 20050654bce352e21520995d8524d4060b486f65 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Thu, 3 Sep 2020 11:20:38 +0200 Subject: [PATCH] make passing bootstrap information optional reason: allow the first node to start without having to wait for a timeout part of #58 --- app/Main.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 3bdb4d4..4810fb0 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -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