Didn't see your response, my gmail auto filter marks my haskell messages as read and puts them in a folder so I have to explicitly check to see. Anyway:
The bit of code I'm stuck on is:
startServer :: NodeSettings -> IO ()
startServer conf = do
print "Bootstrapping, trying to reach configured seed nodes"
let cluster = G.bootstrapNode $ seedNodes conf
print "Initializing Gossip"
gossip cluster conf
print "Listening for client connections"
listenForClients cluster conf
print "Server shutting down..."
The recursive version I had that was similar to yours has long since gone because I couldn't get it to work.
bootstrapNode returns [RemoteNode].
So at the moment the cluster info is fetched once and that's it, where it falls apart in my head is when I try to change this so that cluster is updated every n seconds.
listenForClients is on the main thread with each accepted connection run with forkIO.
All I came up with was after "gossip conf" , I could do
forkIO someFn where
someFn = do
threadDelay n
let cluster = G.bootstrapNode $ seedNodes conf
but obviously this doesn't work because my "gossip" and "listenForClients" functions already have an immutable version of cluster. So I'm not sure how to get the updated version to those fns.
Bare in mind that listenForClients and gossip are doing something similar to
withSocketsDo $ do
sock <- listenOn $ PortNumber(fromInteger gossipPort)
so only accepting a new connection causes those threads to do anything, but when a connection is accepted, if the request demands the cluster data those fns shouldn't go off gathering the data and shouldn't send the (probably) out dated one from the initialization but instead the one that's been updated every n in the background.
Thanks