mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	fix deadlock when AddPeer fails
This commit is contained in:
		
							parent
							
								
									f330f2f5bc
								
							
						
					
					
						commit
						5f1aea3636
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -424,6 +424,7 @@ func (c *Core) AddPeer(addr string, sintf string) error {
 | 
			
		|||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	c.config.Mutex.Lock()
 | 
			
		||||
	defer c.config.Mutex.Unlock()
 | 
			
		||||
	if sintf == "" {
 | 
			
		||||
		for _, peer := range c.config.Current.Peers {
 | 
			
		||||
			if peer == addr {
 | 
			
		||||
| 
						 | 
				
			
			@ -445,7 +446,6 @@ func (c *Core) AddPeer(addr string, sintf string) error {
 | 
			
		|||
			c.config.Current.InterfacePeers[sintf] = append(c.config.Current.InterfacePeers[sintf], addr)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	c.config.Mutex.Unlock()
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue