mirror of
				https://source.quilibrium.com/quilibrium/ceremonyclient.git
				synced 2025-04-04 19:36:54 +00:00 
			
		
		
		
	fix: infinite loop edge case
This commit is contained in:
		
							parent
							
								
									f48f177a10
								
							
						
					
					
						commit
						916a1514f1
					
				| @ -1091,7 +1091,15 @@ func (e *CeremonyDataClockConsensusEngine) collect( | |||||||
| 			latest = e.previousHead | 			latest = e.previousHead | ||||||
| 			e.syncingStatus = SyncStatusNotSyncing | 			e.syncingStatus = SyncStatusNotSyncing | ||||||
| 		} | 		} | ||||||
| 		for { | 
 | ||||||
|  | 		// With large networks and slow syncing machines, this can lead to an
 | ||||||
|  | 		// infinite loop if the list is refreshing fast enough, so make the size
 | ||||||
|  | 		// of the map the maximum loop case:
 | ||||||
|  | 		e.peerMapMx.Lock() | ||||||
|  | 		size := len(e.peerMap) | ||||||
|  | 		e.peerMapMx.Unlock() | ||||||
|  | 
 | ||||||
|  | 		for i := 0; i < size; i++ { | ||||||
| 			peerId, maxFrame, err := e.GetMostAheadPeer() | 			peerId, maxFrame, err := e.GetMostAheadPeer() | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				e.logger.Warn("no peers available, skipping sync") | 				e.logger.Warn("no peers available, skipping sync") | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Cassandra Heart
						Cassandra Heart