mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	add callbacks to maintenance map cleanup
This commit is contained in:
		
							parent
							
								
									12e635f946
								
							
						
					
					
						commit
						9937a6102e
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -293,6 +293,11 @@ func (t *dht) doMaintenance() {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
	t.reqs = newReqs
 | 
			
		||||
	newCallbacks := make(map[dhtReqKey][]func(*dhtRes), len(t.callbacks))
 | 
			
		||||
	for key, callback := range t.callbacks {
 | 
			
		||||
		newCallbacks[key] = callback
 | 
			
		||||
	}
 | 
			
		||||
	t.callbacks = newCallbacks
 | 
			
		||||
	for infoID, info := range t.table {
 | 
			
		||||
		if now.Sub(info.recv) > time.Minute || info.pings > 3 {
 | 
			
		||||
			delete(t.table, infoID)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue