mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	update dht.reset() to possibly play better with coord changes
This commit is contained in:
		
							parent
							
								
									d468882147
								
							
						
					
					
						commit
						c1f8baf9b5
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
					@ -520,9 +520,15 @@ func dht_firstCloserThanThird(first *NodeID,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (t *dht) reset() {
 | 
					func (t *dht) reset() {
 | 
				
			||||||
	// This is mostly so bootstrapping will reset to resend coords into the network
 | 
						// This is mostly so bootstrapping will reset to resend coords into the network
 | 
				
			||||||
 | 
						t.offset = 0
 | 
				
			||||||
 | 
						t.rumorMill = nil // reset mill
 | 
				
			||||||
	for _, b := range t.buckets_hidden {
 | 
						for _, b := range t.buckets_hidden {
 | 
				
			||||||
		b.peers = b.peers[:0]
 | 
							b.peers = b.peers[:0]
 | 
				
			||||||
 | 
							for _, info := range b.other {
 | 
				
			||||||
 | 
								// Add other nodes to the rumor mill so they'll be pinged soon
 | 
				
			||||||
 | 
								// This will hopefully tell them our coords and re-learn theirs quickly if they haven't changed
 | 
				
			||||||
 | 
								t.addToMill(info, info.getNodeID())
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		b.other = b.other[:0]
 | 
							b.other = b.other[:0]
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	t.offset = 0
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue