parent
							
								
									3482876d9b
								
							
						
					
					
						commit
						0494ddd696
					
				
					 4 changed files with 12 additions and 5 deletions
				
			
		|  | @ -55,4 +55,5 @@ readConfig = do | ||||||
|       , confIP = toHostAddress6 . read $ ipString |       , confIP = toHostAddress6 . read $ ipString | ||||||
|       , confDhtPort = read portString |       , confDhtPort = read portString | ||||||
|       , confBootstrapNodes = [(bootstrapHost, read bootstrapPortString)] |       , confBootstrapNodes = [(bootstrapHost, read bootstrapPortString)] | ||||||
|  |       --, confStabiliseInterval = 60 | ||||||
|                            } |                            } | ||||||
|  |  | ||||||
|  | @ -181,11 +181,16 @@ cacheWriter nsSTM = | ||||||
|         modifyTVar' (nodeCacheSTM ns) cacheModifier |         modifyTVar' (nodeCacheSTM ns) cacheModifier | ||||||
| 
 | 
 | ||||||
| stabiliseThread :: LocalNodeStateSTM -> IO () | stabiliseThread :: LocalNodeStateSTM -> IO () | ||||||
| stabiliseThread nsSTM = do | stabiliseThread nsSTM = forever $ do | ||||||
|  |     ns <- readTVarIO nsSTM | ||||||
|     -- TODO: update successfully stabilised nodes in cache |     -- TODO: update successfully stabilised nodes in cache | ||||||
|     -- placeholder |     -- first stabilise immediate neihbours, then the next ones | ||||||
|     stabiliseNeighbour nsSTM successors 1 |     forM_ [1..(kNeighbours ns)] (\num -> do | ||||||
|     pure () |         stabiliseNeighbour nsSTM predecessors num | ||||||
|  |         stabiliseNeighbour nsSTM successors num | ||||||
|  |                                ) | ||||||
|  |     -- TODO: make delay configurable | ||||||
|  |     threadDelay (60 * 1000) | ||||||
|   where |   where | ||||||
|     stabiliseNeighbour :: LocalNodeStateSTM |     stabiliseNeighbour :: LocalNodeStateSTM | ||||||
|                        -> (LocalNodeState -> [RemoteNodeState]) |                        -> (LocalNodeState -> [RemoteNodeState]) | ||||||
|  |  | ||||||
|  | @ -613,6 +613,7 @@ data FediChordConf = FediChordConf | ||||||
|     , confIP             :: HostAddress6 |     , confIP             :: HostAddress6 | ||||||
|     , confDhtPort        :: Int |     , confDhtPort        :: Int | ||||||
|     , confBootstrapNodes :: [(String, PortNumber)] |     , confBootstrapNodes :: [(String, PortNumber)] | ||||||
|  |     --, confStabiliseInterval :: Int | ||||||
|     } |     } | ||||||
|     deriving (Show, Eq) |     deriving (Show, Eq) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -154,7 +154,7 @@ spec = do | ||||||
|     describe "successors and predecessors do not disturb the ring characteristics of EpiChord operations (see #48)" $ do |     describe "successors and predecessors do not disturb the ring characteristics of EpiChord operations (see #48)" $ do | ||||||
|         let |         let | ||||||
|             emptyCache = initCache |             emptyCache = initCache | ||||||
|             -- implicitly relies on kNieghbours to be <= 3 |             -- implicitly relies on kNeighbours to be <= 3 | ||||||
|             thisNid = toNodeID 1000 |             thisNid = toNodeID 1000 | ||||||
|             thisNode = setNid thisNid <$> exampleLocalNode |             thisNode = setNid thisNid <$> exampleLocalNode | ||||||
|             nid2 = toNodeID 1003 |             nid2 = toNodeID 1003 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue