avoid connecting to self
This commit is contained in:
		| @@ -382,8 +382,23 @@ func (n *network) initNodes(startup bool) { | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	// strip self | ||||||
|  | 	var init []string | ||||||
|  |  | ||||||
|  | 	// our current address | ||||||
|  | 	advertised := n.server.Options().Advertise | ||||||
|  |  | ||||||
|  | 	for _, node := range nodes { | ||||||
|  | 		// skip self | ||||||
|  | 		if node == advertised { | ||||||
|  | 			continue | ||||||
|  | 		} | ||||||
|  | 		// add the node | ||||||
|  | 		init = append(init, node) | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	// initialize the tunnel | 	// initialize the tunnel | ||||||
| 	log.Tracef("Network initialising nodes %+v\n", nodes) | 	log.Tracef("Network initialising nodes %+v\n", init) | ||||||
|  |  | ||||||
| 	n.tunnel.Init( | 	n.tunnel.Init( | ||||||
| 		tunnel.Nodes(nodes...), | 		tunnel.Nodes(nodes...), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user