mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-24 16:57:53 +00:00
Make AddPeer remember added peer (as opposed to CallPeer which does not)
This commit is contained in:
parent
a830521078
commit
399e1a2ffe
@ -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
|
||||
// drops.
|
||||
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user