preliminary passing of bootstrap nodes in Main to fediChordJoin
This commit is contained in:
parent
ad1465c5fe
commit
43eb04dfea
|
@ -334,4 +334,5 @@ mkSendSocket dest destPort = do
|
|||
destAddr <- addrAddress <$> resolve (Just dest) (Just destPort)
|
||||
sendSock <- socket AF_INET6 Datagram defaultProtocol
|
||||
setSocketOption sendSock IPv6Only 1
|
||||
connect sendSock destAddr
|
||||
pure sendSock
|
||||
|
|
|
@ -37,6 +37,7 @@ module Hash2Pub.FediChord (
|
|||
, bsAsIpAddr
|
||||
, FediChordConf(..)
|
||||
, fediChordInit
|
||||
, fediChordJoin
|
||||
, nodeStateInit
|
||||
, mkServerSocket
|
||||
, mkSendSocket
|
||||
|
|
|
@ -422,6 +422,7 @@ data FediChordConf = FediChordConf
|
|||
{ confDomain :: String
|
||||
, confIP :: HostAddress6
|
||||
, confDhtPort :: Int
|
||||
, confBootstrapNodes :: [(String, PortNumber)]
|
||||
}
|
||||
deriving (Show, Eq)
|
||||
|
||||
|
|
|
@ -18,15 +18,17 @@ main = do
|
|||
-- currently no masking is necessary, as there is nothing to clean up
|
||||
cacheWriterThread <- forkIO $ cacheWriter thisNode
|
||||
-- idea: list of bootstrapping nodes, try joining within a timeout
|
||||
joinedState <- fediChordJoin thisNode $ head . confBootstrapNodes $ conf
|
||||
-- stop main thread from terminating during development
|
||||
getChar
|
||||
pure ()
|
||||
|
||||
readConfig :: IO FediChordConf
|
||||
readConfig = do
|
||||
confDomainString : ipString : portString : _ <- getArgs
|
||||
confDomainString : ipString : portString : bootstrapHost : bootstrapPortString : _ <- getArgs
|
||||
pure $ FediChordConf {
|
||||
confDomain = confDomainString
|
||||
, confIP = toHostAddress6 . read $ ipString
|
||||
, confDhtPort = read portString
|
||||
, confBootstrapNodes = [(bootstrapHost, read bootstrapPortString)]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue