mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Make AddPeer remember added peer (as opposed to CallPeer which does not)
This commit is contained in:
		
							parent
							
								
									a830521078
								
							
						
					
					
						commit
						399e1a2ffe
					
				
					 1 changed files with 11 additions and 1 deletions
				
			
		| 
						 | 
					@ -309,7 +309,17 @@ func (c *Core) SetLogger(log *log.Logger) {
 | 
				
			||||||
// peer to the peer list, so that they will be called again if the connection
 | 
					// peer to the peer list, so that they will be called again if the connection
 | 
				
			||||||
// drops.
 | 
					// drops.
 | 
				
			||||||
func (c *Core) AddPeer(addr string, sintf string) error {
 | 
					func (c *Core) AddPeer(addr string, sintf string) error {
 | 
				
			||||||
	return c.admin.addPeer(addr, sintf)
 | 
						if err := c.CallPeer(addr, sintf); err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						c.config.Mutex.Lock()
 | 
				
			||||||
 | 
						if sintf == "" {
 | 
				
			||||||
 | 
							c.config.Current.Peers = append(c.config.Current.Peers, addr)
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							c.config.Current.InterfacePeers[sintf] = append(c.config.Current.InterfacePeers[sintf], addr)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						c.config.Mutex.Unlock()
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Calls a peer. This should be specified in the peer URI format, i.e.
 | 
					// Calls a peer. This should be specified in the peer URI format, i.e.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue