forked from schmittlauch/Hash2Pub
		
	make all delays configurable and scale them according to a speedup factor
This commit is contained in:
		
							parent
							
								
									20050654bc
								
							
						
					
					
						commit
						4f08d33d2e
					
				
					 3 changed files with 43 additions and 38 deletions
				
			
		
							
								
								
									
										26
									
								
								app/Main.hs
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								app/Main.hs
									
										
									
									
									
								
							|  | @ -45,27 +45,31 @@ main = do | |||
| 
 | ||||
| readConfig :: IO (FediChordConf, ServiceConf) | ||||
| readConfig = do | ||||
|     confDomainString : ipString : portString : servicePortString : speedup : remainingArgs <- getArgs | ||||
|     confDomainString : ipString : portString : servicePortString : speedupString : remainingArgs <- getArgs | ||||
|     -- allow starting the initial node without bootstrapping info to avoid | ||||
|     -- waiting for timeout | ||||
|     let | ||||
|         speedup = read speedupString | ||||
|         confBootstrapNodes' = case remainingArgs of | ||||
|             bootstrapHost : bootstrapPortString : _ -> | ||||
|                 [(bootstrapHost, read bootstrapPortString)] | ||||
|             _ -> [] | ||||
|         fConf = FediChordConf { | ||||
|         confDomain = confDomainString | ||||
|       , confIP = toHostAddress6 . read $ ipString | ||||
|       , confDhtPort = read portString | ||||
|       , confBootstrapNodes = confBootstrapNodes' | ||||
|       --, confStabiliseInterval = 60 | ||||
|       , confBootstrapSamplingInterval = 180 | ||||
|       , confMaxLookupCacheAge = 300 | ||||
|             confDomain = confDomainString | ||||
|           , confIP = toHostAddress6 . read $ ipString | ||||
|           , confDhtPort = read portString | ||||
|           , confBootstrapNodes = confBootstrapNodes' | ||||
|           , confStabiliseInterval = 60 * 10^6 | ||||
|           , confBootstrapSamplingInterval = 180 * 10^6 `div` speedup | ||||
|           , confMaxLookupCacheAge = 300 / fromIntegral speedup | ||||
|           , confJoinAttemptsInterval = 60 * 10^6 `div` speedup | ||||
|           , confMaxNodeCacheAge = 600 / fromIntegral speedup | ||||
|           , confResponsePurgeAge = 60 / fromIntegral speedup | ||||
|                            } | ||||
|         sConf = ServiceConf { | ||||
|         confSubscriptionExpiryTime = fromIntegral $ 2*3600 `div` (read speedup :: Integer) | ||||
|                             , confServicePort = read servicePortString | ||||
|                             , confServiceHost = confDomainString | ||||
|             confSubscriptionExpiryTime = fromIntegral $ 2*3600 `div` speedup | ||||
|           , confServicePort = read servicePortString | ||||
|           , confServiceHost = confDomainString | ||||
|                             } | ||||
|     pure (fConf, sConf) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue