mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Enforce CKR cache size more strongly
This commit is contained in:
		
							parent
							
								
									65e34bbbab
								
							
						
					
					
						commit
						90ace46587
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -244,11 +244,11 @@ func (c *cryptokey) getPublicKeyForAddress(addr address, addrlen int) (boxPubKey
 | 
				
			||||||
			// Check if the routing cache is above a certain size, if it is evict
 | 
								// Check if the routing cache is above a certain size, if it is evict
 | 
				
			||||||
			// a random entry so we can make room for this one. We take advantage
 | 
								// a random entry so we can make room for this one. We take advantage
 | 
				
			||||||
			// of the fact that the iteration order is random here
 | 
								// of the fact that the iteration order is random here
 | 
				
			||||||
			if len(*routingcache) > 1024 {
 | 
					 | 
				
			||||||
			for k := range *routingcache {
 | 
								for k := range *routingcache {
 | 
				
			||||||
					delete(*routingcache, k)
 | 
									if len(*routingcache) < 1024 {
 | 
				
			||||||
					break
 | 
										break
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
									delete(*routingcache, k)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Cache the entry for future packets to get a faster lookup
 | 
								// Cache the entry for future packets to get a faster lookup
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue